id
int32 0
32.5k
| code
stringlengths 95
8.4k
| label
stringclasses 65
values |
---|---|---|
4,200 | int main()
{
int n;
scanf("%d",&n);
int i,j;
char id[100][10];
int age[100];
char oid[100][10];
int oage[100];
for(i=0;i<n;i++)
{
scanf("%s",id[i]);
scanf("%d",&age[i]);
}
int k=0;
for(i=0;i<n;i++)
{
if(age[i]>=60)
{
oage[k]=age[i];
strcpy(oid[k],id[i]);k++;
}
}
for(i=1;i<k;i++)
{
for(j=0;j<k-i;j++)
{
if(oage[j]<oage[j+1])
{
int e;
e=oage[j];
oage[j]=oage[j+1];
oage[j+1]=e;
char f[10];
strcpy(f,oid[j]);
strcpy(oid[j],oid[j+1]);
strcpy(oid[j+1],f);
}
}
}
for(i=0;i<k;i++)
{
printf("%s\n",oid[i]);
}
for(i=0;i<n;i++)
{
if(age[i]<60)printf("%s\n",id[i]);
}
return 0;
}
| 9 |
4,201 | void main()
{
int n,i,j;
struct p{
char id[30];
int ag;
}a[105],temp;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d",a[i].id,&a[i].ag);
}
for(i=0;i<n-1;i++){
for(j=1;j<n-i;j++){
if(a[j-1].ag>=60&&a[j].ag>=60){
if(a[j-1].ag<a[j].ag){
temp=a[j-1];
a[j-1]=a[j];
a[j]=temp;
}
}
else if(a[j-1].ag<60&&a[j].ag>=60){
temp=a[j-1];
a[j-1]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<n;i++)printf("%s\n",a[i].id);
} | 9 |
4,202 | struct Patient{
char id[10];
int age;
struct Patient *next;
struct Patient *pre;
};
struct Patient *creat(int x);
struct Patient *sort(struct Patient *);
void print(struct Patient *);
int main()
{
struct Patient *patient,*patient2;
int n,i;
scanf("%d",&n);
patient=creat(n);
patient2=sort(patient);
print(patient2);
}
struct Patient *creat(int x){
struct Patient *p1,*p2,*head,*p;
int i;
head = NULL;
for (i=0;i<x;i++){
p1 = (struct Patient *)malloc(Len);
if (i==0) {head = p1;head->pre = NULL;}
else {p2->next = p1;p1->pre = p2;}
p2 = p1;
scanf("%s%d",p1->id,&p1->age);
}
p1->next = NULL;
return head;
}
struct Patient *sort(struct Patient *head){
struct Patient *p1,*p2,*temp,*p;
temp = (struct Patient *)malloc(Len);
p1 = p2 =head;
while (p1){
if (p1->age>=60){
p2 = p1->next;
while (p2){
if (p2->age>p1->age){
temp->age = p2->age;
strcpy(temp->id,p2->id);
p = p2;
while (p->pre != p1){
strcpy(p->id,p->pre->id);
p->age = p->pre->age;
p = p->pre;
}
strcpy(p->id,p1->id);
p->age = p1->age;
p1->age = temp->age;
strcpy(p1->id,temp->id);
}
p2 = p2->next;
}
}
p1 = p1->next;
}
return head;
}
void print(struct Patient *head){
struct Patient *p1,*p2,*p;
p = head;
while (p){
if (p->age>=60){
printf("%s\n",p->id);
}
p = p->next;
}
p = head;
while (p){
if (p->age<60){
printf("%s\n",p->id);
}
p = p->next;
}
} | 9 |
4,203 | void main()
{int n;
scanf ("%d",&n);
struct patient
{ int num[10];int age;}
patient[100];
struct a
{ int num[10];int age;}
a[100];
int i,j=0;int t=0;
for (i=0;i<n;i++)
scanf ("%s %d",patient[i].num,&patient[i].age);
for (i=0;i<n;i++)
{ if (patient[i].age>=60) {strcpy(a[j].num,patient[i].num);
a[j].age=patient[i].age;j++;}}
int k=j; int m=a[0].age;
i=0;
while (i<k)
{
{for (j=0;j<k;j++)
if (m<a[j].age) {m=a[j].age; t=j;}}
printf("%s\n",a[t].num);a[t].age=0;m=0;i++;}
for (i=0;i<n;i++)
{if(patient[i].age<60) printf("%s\n",patient[i].num);}
} | 9 |
4,204 | int main()
{
int n,i,j,k,f,g,t;
scanf("%d",&n);
int p[n],e[n],d[n];
char a[n][100],b[n][100],c[n][100],s[100];
for(i=0;i<n;i++)
{
scanf("%s %d",a[i],&p[i]);
}
j=0,k=0;
for(i=0;i<n;i++)
{
if(p[i]>=60)
{
e[j]=p[i];
strcpy(b[j],a[i]);
j++;
}
else
{
strcpy(c[k],a[i]);
k++;
}
}
for(f=0;f<j-1;f++)
{
for(g=0;g<j-1-f;g++)
{
if(e[g]<e[g+1])
{
t=e[g+1];
e[g+1]=e[g];
e[g]=t;
strcpy(s,b[g+1]);
strcpy(b[g+1],b[g]);
strcpy(b[g],s);
}
}
}
for(i=0;i<j;i++)
{printf("%s\n",b[i]);}
for(i=0;i<k;i++)
{printf("%s\n",c[i]);}
getchar();
getchar();
}
| 9 |
4,205 | main()
{ char temp_0[10],id[100][10];
int i,j,n,max,age[100],num[100],yes[100],ncount=1,temp,num_1;
scanf("%d",&n);
for(i=0;i<n;i++)
{num[i]=i;
scanf("%s %d",id[i],&age[i]);
}
for(j=0;j<n;j++)//????????????
{
for(i=0;i<n-j-1;i++)//??
{ if(age[i]<age[i+1])
{ strcpy(temp_0,id[i]);//??????????????
temp=age[i];
num_1=num[i];
strcpy(id[i],id[i+1]);
age[i]=age[i+1];
num[i]=num[i+1];
age[i+1]=temp;
strcpy(id[i+1],temp_0);
num[i+1]=num_1; }
}}
for(i=0;i<n;i++)//???60?????
{if(age[i]>=60)
printf("%s\n",id[i]);
}
for(j=0;j<n;j++)// ???????
{for(i=0;i<n-j-1;i++)
{if(num[i]>num[i+1])
{ strcpy(temp_0,id[i]);
temp=age[i];
num_1=num[i];
strcpy(id[i],id[i+1]);
age[i]=age[i+1];
num[i]=num[i+1];
age[i+1]=temp;
strcpy(id[i+1],temp_0);
num[i+1]=num_1;
}}
}
for(i=0;i<n;i++)
{if(age[i]<60)//????60?????
printf("%s\n",id[i]);}
}
| 9 |
4,206 | struct sick
{char name[10];
int age;
};
int main()
{
int n,i,count=0,j;
struct sick s[100],a[100],t;
char b[3];
gets(b);
n=atoi(b);
for(i=0;i<n;i++)
scanf("%s %d",s[i].name,&s[i].age);
if(n==1)
printf("%s",s[0].name);
else
{for(i=0;i<n;i++)
if(s[i].age>=60)
{a[count]=s[i];
count++;
}
for(i=0;i<count-1;i++)
for(j=0;j<count-1-i;j++)
if(a[j].age <a[j+1].age )
{t=a[j];a[j]=a[j+1];a[j+1]=t;}
for(i=0;i<count;i++)
printf("%s\n",a[i].name);
for(i=0;i<n;i++)
if(s[i].age<60)
printf("%s\n",s[i].name);
}
return 0;
}
| 9 |
4,207 |
char id[NUM][LEN],oldid[NUM][LEN],newid[NUM][LEN];
int age[NUM];
int oldage[NUM],newage[NUM];
int main(){
int num;
int i=0,j=0, k=0,n=0;
int e_oldage;
char e_oldid[LEN];
scanf("%d", &num);
for(i = 0; i < num; i++){
scanf("%s %d ", id[i], &(age[i]));
}
for(i=0;i<num;i++){
if(age[i]>=60){
oldage[j]= age[i];
strcpy(oldid[j], id[i]);
j++;
}else {
newage[n]= age[i];
strcpy(newid[n], id[i]);
n++;
}
}
for(k = 1 ; k <= j; k++){
for(i = 0; i < j- k; i++){
if( oldage[i] < oldage[i+1]){
e_oldage = oldage[i+1];
strcpy(e_oldid, oldid[i+1]);
oldage[i+1] = oldage[i];
strcpy(oldid[i+1], oldid[i]);
oldage[i] = e_oldage;
strcpy(oldid[i], e_oldid);
}
}
}
for(i=0;i<j;i++){
printf("%s\n",oldid[i]);
}
for(i=0;i<n;i++){
printf("%s\n",newid[i]);
}
return 0;
} | 9 |
4,208 | struct kb
{
char ID[10];
int nl;
}kbr[100],lnr[100],ln;
int main()
{
int n,i,k=0,l;
scanf("%d",&n);
for (i=0;i<n;i++){
scanf("%s%d",&kbr[i].ID,&kbr[i].nl);
}
for (i=0;i<n;i++){
if(kbr[i].nl>=60){
strcpy(lnr[k].ID,kbr[i].ID);
lnr[k].nl=kbr[i].nl;
k++;
strcpy(kbr[i].ID,"000000000");
}
}
for (i=1;i<k;i++){
for(l=0;l<k-i;l++){
if(lnr[l].nl<lnr[l+1].nl){
ln=lnr[l+1];
lnr[l+1]=lnr[l];
lnr[l]=ln;
}
}
}
for (i=0;i<k;i++){
printf("%s\n",lnr[i].ID);
}
for (i=0;i<n;i++){
if(strcmp(kbr[i].ID,"000000000")==1){
printf("%s\n",kbr[i].ID);
}
}
return 0;
}
| 9 |
4,209 | int main()
{
int i,n,t=0,e,num=0,k;
char z[10];
struct point
{
char ID[10];
int age;
}a[100],b[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",&a[i].ID);
scanf("%d",&a[i].age);
}
for(i=0;i<n;i++)
{
if(a[i].age>=60)
{
num=num+1;
}
}
int f=num;
for(i=0;i<n;i++)
{
if(a[i].age>=60)
{
b[t].age=a[i].age;
strcpy(b[t].ID,a[i].ID);
t++;
}
if(a[i].age<60)
{
b[f].age=a[i].age;
strcpy(b[f].ID,a[i].ID);
f++;
}
}
for(i=0;i<num;i++)
{
for(k=0;k<num-i-1;k++)
{
if(b[k].age<b[k+1].age)
{
e=b[k].age;
b[k].age=b[k+1].age;
b[k+1].age=e;
strcpy(z,b[k+1].ID);
strcpy(b[k+1].ID,b[k].ID);
strcpy(b[k].ID,z);
}
}
}
for(i=0;i<n;i++)
{
printf("%s\n",b[i].ID);
}
return 0;
} | 9 |
4,210 | struct arr
{
char id[10];
int age;
struct arr *next;
};
int n;
struct arr *create(int m)
{
struct arr *head;
struct arr *p1,*p2;
n=1;
p1=p2=(struct arr *) malloc(LEN);
scanf("%s %d",&p1->id,&p1->age);
head=p1;
while(n<m)
{
p1=(struct arr *)malloc(LEN);
p2->next=p1;
n++;
p2=p1;
scanf("%s %d",&p1->id,&p1->age);
}
p1->next=NULL;
return(head);
}
struct arr *del(struct arr *head,long int dnum)
{
struct arr *p1,*p2;
p1=p2=head;
while(p1!=NULL&&p1->age==dnum)
{
head=p1->next;
p2=head;
free(p1);
p1=head;
}
while(p1!=NULL)
{
p2=p1;
p1=p1->next;
while(p1!=NULL&&p1->age==dnum)
{
p2->next=p1->next;
free(p1);
p1=p2->next;
}
}
return(head);
}
void print(struct arr *head)
{
struct arr *p;
p=head;
while(p!=NULL)
{
if(p==head)
printf("%s\n",p->id);
else printf("%s\n",p->id);
p=p->next;
}
}
void freelist(struct arr *head)
{
struct arr *p=head ;
if(head!=NULL)
{
while(p!=NULL)
{
head=head->next;
free(p);
p=head;
}
}
}
void main()
{
struct arr *head,*p1;
int m,max=0;
scanf("%d",&m);
head=create(m);
for(;;)
{
max=0;
for(p1=head;p1!=NULL;p1=p1->next)
{
max=(max>p1->age)?max:p1->age;
}
if(max>=60)
{
for(p1=head;p1!=NULL;p1=p1->next)
{
if(p1->age==max)
printf("%s\n",p1->id);
}
head=del(head,max);
}
else break;
}
print(head);
freelist(head);
}
| 9 |
4,211 |
struct student
{
char num[11];
int age;
};
int main(int argc, char *argv[])
{
int n,i,j;
scanf("%d",&n);
struct student pa[n];
for (i=0;i<=n-1;i++)
scanf("%s%d",pa[i].num,&pa[i].age);
struct student temp;
for (j=n-1;j>=1;j--)
{
for (i=0;i<=j-1;i++)
{
if (pa[i].age<pa[i+1].age&&!(pa[i].age<60&&pa[i+1].age<60))
{temp=pa[i];pa[i]=pa[i+1];pa[i+1]=temp;}
}
}
for (i=0;i<=n-1;i++)
{
printf("%s",pa[i].num);
(i<=n-2)?printf("\n"):printf("");
}
return 0;
}
| 9 |
4,212 | struct old
{
char ID[10];
int age;
};
void main()
{
struct old a[100],b[100],c[100];
int n,i,j,B=0,C=0,temp;
char TEMP[10];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",&a[i].ID,&a[i].age);
if(a[i].age>=60)
{
strcpy(b[B].ID,a[i].ID);
b[B].age=a[i].age;
B++;
}
else
{
strcpy(c[C].ID,a[i].ID);
c[C].age=a[i].age;
C++;
}
}
for(i=B-1;i>=0;i--)
{
for(j=0;j<i;j++)
{
if(b[j].age<b[j+1].age||(b[j].age==b[j+1].age&&((b[j].ID-'\0')>(b[j+1].ID-'\0'))))
{
temp=b[j+1].age,b[j+1].age=b[j].age,b[j].age=temp;
strcpy(TEMP,b[j+1].ID),strcpy(b[j+1].ID,b[j].ID),strcpy(b[j].ID,TEMP);
}
}
}
for(i=C-1;i>=0;i--)
{
for(j=0;j<i;j++)
{
if((c[j].ID-'\0')>(c[j+1].ID-'\0'))
{
temp=c[j+1].age,c[j+1].age=c[j].age,c[j].age=temp;
strcpy(TEMP,c[j+1].ID),strcpy(c[j+1].ID,c[j].ID),strcpy(c[j].ID,TEMP);
}
}
}
for(i=0;i<B;i++)
printf("%s\n",b[i].ID);
for(i=0;i<C;i++)
printf("%s\n",c[i].ID);
}
| 9 |
4,213 | int main()
{
int n,sz[100],i=0,a[100],b[100],p=0,q=0,m=0;
char sz1[100][100],a1[100][100],b1[100][100],e[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",sz1[i],&sz[i]);
for(i=0;i<n;i++)
{
if(sz[i]>=60)
{
a[p]=sz[i];
strcpy(a1[p],sz1[i]);
p++;
}
if(sz[i]<60)
{
b[q]=sz[i];
strcpy(b1[q],sz1[i]);
q++;
}
}
for(i=1;i<p;i++)
{
for(m=0;m<p-i;m++)
{
if(a[m]<a[m+1])
{
int t = a[m];
a[m] = a[m+1];
a[m+1] = t;
strcpy(e,a1[m]);
strcpy(a1[m],a1[m+1]);
strcpy(a1[m+1],e);
}
}
}
for(i=0;i<p;i++)
printf("%s\n",a1[i]);
for(m=0;m<q;m++)
printf("%s\n",(b1[m]));
return 0;
}
| 9 |
4,214 |
struct info
{
char num[10];
int age;
};
struct info1
{
char num1[10];
int age1;
};
int main(int argc, char* argv[])
{
struct info patient[101];
struct info1 old[101];
int n;
scanf("%d",&n);
int i,j;
for(i=0,j=0;i<n;i++){
scanf("%s %d",&patient[i].num,&patient[i].age);
if(patient[i].age>=60){
strcpy(old[j].num1,patient[i].num);
old[j].age1=patient[i].age;
j++;
}
}
int m=j;
for(j=1;j<m;j++){
for(i=0;i<m-j;i++){
if(old[i].age1<old[i+1].age1){
old[100]=old[i];
old[i]=old[i+1];
old[i+1]=old[100];
}
}
}
for(i=0;i<m;i++){
printf("%s\n",old[i].num1);
}
for(i=0;i<n;i++){
if(patient[i].age<60){
printf("%s\n",patient[i].num);
}
}
return 0;
} | 9 |
4,215 | int main(int argc, char* argv[])
{
char id[100][100];
int age[100];
int n;
int i,k;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",id[i]);
scanf("%d",&age[i]);
}
int e;
char t[13];
char id1[100][13];
int age1[100];
char id2[100][13];
int age2[100];
int x=0,y=0;
for(i=0;i<n;i++){
if(age[i]>=60){
age1[x]=age[i];
strcpy(id1[x],id[i]);
x++;
}
if(age[i]<60){
age2[y]=age[i];
strcpy(id2[y],id[i]);
y++;
}
}
for(k=1;k<x;k++){
for(i=0;i<x-k;i++){
if(age1[i]<age1[i+1]){
e=age1[i+1];
age1[i+1]=age1[i];
age1[i]=e;
strcpy(t,id1[i+1]);
strcpy(id1[i+1],id1[i]);
strcpy(id1[i],t);
}
}
}
for(i=0;i<x;i++){
printf("%s\n",id1[i]);
}
for(i=0;i<y;i++){
printf("%s\n",id2[i]);
}
return 0;
}
| 9 |
4,216 |
char id[101][11];
int main()
{ int n;
int age[101],a[101];
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
scanf("%s%d",id[i],&age[i]);
int j=i;
if (age[i]>=60)
{
for (;j>1&&age[a[j-1]]<age[i];j--)
a[j]=a[j-1];
}
a[j]=i;
}
for (int i=1;i<=n;i++)
printf("%s\n",id[a[i]]);
getchar();
getchar();
return 0;
}
| 9 |
4,217 | int main()
{
int n,t;
int i,j=0,k,max;
int age[100];
int age2[100];
char string[100][11];
int line[100];
scanf("%d",&n);
for(i=0;i<=n-1;i++)
scanf("%s %d",string[i],&age[i]);
for(i=0;i<=n-1;i++)
{
if (age[i]>=60)
{
age2[j]=age[i];
age[i]=0;
line[j]=i;
j=j+1;
k=j;
}
}
for(i=1;i<=k;i++)
{
max=0;
t=0;
for(j=0;j<=k-1;j++)
{
if(max<age2[j])
{
max=age2[j];
t=j;
}
}
printf("%s\n",string[line[t]]);
age2[t]=0;
}
for(i=0;i<n;i++)
{
if(age[i]!=0)
printf("%s\n",string[i]);
}
getchar();
getchar();
}
| 9 |
4,218 | int main()
{
struct pa
{
char ID[10];
int age;
}
*p;
int n, i, k, num=0, m=0;
scanf("%d",&n);
p=(struct pa*)malloc(sizeof(struct pa)*n);
for(i=0;i<n;i++)
{
scanf("%s%d",p[i].ID, &p[i].age);
if(p[i].age>=60) num++;
}
int w=0;
for(i=0;i<n;i++)
{
if(p[i].age>=60)
{
struct pa q=p[i];
for(k=i;k>w;k--)
{
p[k]=p[k-1];
}
p[w]=q;
w++;
}
}
for(i=num-1;i>0;i--)
{
for(k=0;k<i;k++)
{
if(p[k].age<p[k+1].age)
{
struct pa q=p[k];
p[k]=p[k+1];
p[k+1]=q;
}
}
}
for(i=0;i<n;i++)
{
printf("%s\n",p[i].ID);
}
free(p);
return 0;
}
| 9 |
4,219 | struct ill
{
char id[11];
int age;
struct ill*next;
};
struct ill*creat(int n)
{struct ill*head,*p1,*p2;
int i;
head=NULL;
for(i=0;i<n;i++)
{p1=(struct ill*)malloc(sizeof(struct ill));
scanf("%s %d",p1->id,&p1->age);
if(i==0)head=p1;
else p2->next=p1;
p2=p1;
}
p2->next=NULL;
return(head);
}
struct ill* arrang(struct ill*head)
{int t,tt;
char s[11],ss[11];
struct ill*p,*q,*m,*h;
for(p=head;p!=NULL;p=p->next)
{
if(p->age>=60)
{
for(m=p,q=p->next;q!=NULL;q=q->next)
if(q->age > m->age && m->age>=60 ) m=q;
{t=tt=p->age; strcpy(s,p->id); strcpy(ss,p->id);
for(h=p->next;h!=m->next;h=h->next)
{tt=h->age; strcpy(ss,h->id);
h->age=t; strcpy(h->id,s);
t=tt; strcpy(s,ss);
}
p->age=t; strcpy(p->id,s);
}
}
}
return(head);
}
void main()
{int n;
struct ill*head,*h;
scanf("%d",&n);
head=creat(n);
head=arrang(head);
for(h=head;h!=NULL;h=h->next)
if(h->age>=60) printf("%s\n",h->id);
for(h=head;h!=NULL;h=h->next)
if(h->age<60) printf("%s\n",h->id);
} | 9 |
4,220 | struct pat
{
char num[10];
int age;
}pat[100],str[100],t;
int main()
{
int n,i,j,a=-1,temp;
int ch[100];
char c[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",pat[i].num,&pat[i].age);
if(pat[i].age>=60)
{
a++;
strcpy(str[a].num,pat[i].num);
str[a].age=pat[i].age;
}
}
for(i=a;i>=1;i--)
{
for(j=0;j<i;j++)
{
if(str[j].age<str[j+1].age)
{
t=str[j];
str[j]=str[j+1];
str[j+1]=t;
}
}
}
for(i=0;i<n;i++)
{
if(pat[i].age<60)
{
a++;
str[a]=pat[i];
}
}
for(i=0;i<n;i++)
{
printf("%s\n",str[i].num);
}
}
| 9 |
4,221 | struct oldpeople
{
char id[20];
int year;
}old[100],old60[100],cache;
int main()
{
int n;int i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",old[i].id,&old[i].year);
}
int j=0;
for(i=0;i<n;i++)
{
if(old[i].year>=60)
{ old60[j]=old[i];j++;}
}
int k;
for(i=0;i<j;i++)
{
for(k=0;k<j-i;k++)
{
if(old60[k].year<old60[k+1].year)
{
cache=old60[k+1];
old60[k+1]=old60[k];
old60[k]=cache;
}
}
}
for(i=0;i<j;i++)
{
printf("%s\n",old60[i].id);
}
for(i=0;i<n;i++)
{
if(old[i].year<60)
printf("%s\n",old[i].id);
}
return 0;
}
| 9 |
4,222 | int main(){
int i,j,n,k=0,b[100],c=0,eb;
char a[100][10],ea[10];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",a[i],&b[i]);
for(j=0;j<n;j++){
for(i=n-1;i>j;i--){
if(b[i]>b[i-1]&&b[i]>=60){
eb=b[i];
b[i]=b[i-1];
b[i-1]=eb;
strcpy(ea,a[i]);
strcpy(a[i],a[i-1]);
strcpy(a[i-1],ea);
}
}
}
for(i=0;i<n;i++)
printf("%s\n",a[i]);
return 0;
} | 9 |
4,223 | main()
{
int n,i,j,k,m,l;
int age[10000];
char ID[10000][10],order[10000][10];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",ID[i],&age[i]);
}
for(i=0;i<n;i++)
{
m=0;
for(j=1;j<n-i;j++)
{
if(age[j]>=60&&age[j]>age[m])
m=j;
}
for(j=0;j<10;j++)
{
order[i][j]=ID[m][j];
}
for(j=m;j<n;j++)
{
for(k=0;k<10;k++)
{
ID[j][k]=ID[j+1][k];
}
age[j]=age[j+1];
}
}
for(i=0;i<n;i++)
{
puts(order[i]);
}
} | 9 |
4,224 | struct stru
{
char id[20];
int age;
struct stru *next;
}*head,*p,*q;
void creat(int N)
{
int i;
p=q=(struct stru *)malloc(LEN);
head=p;
scanf("%s %d",p->id,&p->age);
for(i=1;i<N;i++)
{
p=(struct stru *)malloc(LEN);
scanf("%s %d",p->id,&p->age);
q->next=p;
q=p;
}
q->next=NULL;
}
void arrange(struct stru *head,int N)
{
int i,temp;char media[20];
for(i=0;i<N;i++)
for(p=head,q=head->next;q!=NULL;p=p->next,q=q->next)
{
if(q->age>=60 && q->age>p->age)
{
strcpy(media,p->id);
strcpy(p->id,q->id);
strcpy(q->id,media);
temp=p->age;
p->age=q->age;
q->age=temp;
}
}
}
void print(struct stru *head)
{
for(p=head;p!=NULL;p=p->next)
printf("%s\n",p->id);
}
void main()
{
int N;
scanf("%d",&N);
creat(N);
//print(head);
arrange(head,N);
print(head);
}
| 9 |
4,225 | struct pat
{
char id[10];
int age;
struct pat *next;
};
void main()
{
struct pat *head,*p;
int i,n;
void search(struct pat *head,int n);
scanf("%d",&n);
head=(struct pat*)malloc(sizeof(struct pat));
p=head;p->next=NULL;
scanf("%s %d",p->id,&p->age);
for(i=1;i<n;i++)
{
p->next=(struct pat*)malloc(sizeof(struct pat));
p=p->next;
scanf("%s %d",p->id,&p->age);
p->next=NULL;
}
search(head,n);
}
void search(struct pat *head,int n)
{
int i,j=0,k=0;
struct pat *t,*m,*p,*head1,*head2;
struct pat *sort(struct pat *head1,int j);
void print(struct pat *head1,struct pat *head2,int j,int k);
p=head;
t=(struct pat*)malloc(sizeof(struct pat));
m=(struct pat*)malloc(sizeof(struct pat));
for(i=0;i<n;i++)
{
if(p->age>=60)
{
j++;
if(j==1) head1=t;
strcpy(t->id,p->id);t->age=p->age;
t->next=(struct pat*)malloc(sizeof(struct pat));
t=t->next;t->next=NULL;
}
else
{
k++;
if(k==1) head2=m;
strcpy(m->id,p->id);m->age=p->age;
m->next=(struct pat*)malloc(sizeof(struct pat));
m=m->next;m->next=NULL;
}
p=p->next;
}
sort(head1,j);
print(head1,head2,j,k);
}
struct pat *sort(struct pat *head1,int j)
{
int i,l,t;
char a[10];
struct pat *p1,*p2;
for(i=0;i<j-1;i++)
{
p1=head1;
for(l=0;l<j-i-1;l++)
{
p2=p1;p1=p1->next;
if(p1->age>p2->age)
{
t=p1->age;p1->age=p2->age;p2->age=t;
strcpy(a,p1->id);strcpy(p1->id,p2->id);strcpy(p2->id,a);
}
}
}
return(head1);
}
void print(struct pat *head1,struct pat *head2,int j,int k)
{
int i;
struct pat *p;
p=head1;
for(i=0;i<j;i++)
{
printf("%s\n",p->id);
p=p->next;
}
p=head2;
for(i=0;i<k;i++)
{
printf("%s\n",p->id);
p=p->next;
}
}
| 9 |
4,226 | struct
{
char id[11];
int nianling;
}bing[100];
int main()
{
int n,i,j,e;
int youxian[100]={0};
int zhengchang[100]={0};
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%s %d", bing[i].id,&bing[i].nianling);
if(bing[i].nianling>=60) youxian[i]=bing[i].nianling;
else zhengchang[i]=bing[i].nianling;
}
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(youxian[j]<youxian[j+1])
{
e=youxian[j+1];
youxian[j+1]=youxian[j];
youxian[j]=e;
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(bing[j].nianling==youxian[i])
{
printf("%s\n", bing[j].id);
bing[j].nianling=-1;
break;
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(bing[j].nianling==zhengchang[i])
{
printf("%s\n", bing[j].id);
bing[j].nianling=-1;
break;
}
}
}
return 0;
}
| 9 |
4,227 | main()
{
int n,i,k,t;
int d[100];
char c[100][10],e[10];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%s %d",c[i-1],&d[i-1]);
for(i=1;i<=n-1;i++)
{
for(k=n;k>=i+1;k--)
{
if(d[k-1]>d[k-2]&&d[k-1]>=60)
{
t=d[k-2];
d[k-2]=d[k-1];
d[k-1]=t;
strcpy(e,c[k-2]);
strcpy(c[k-2],c[k-1]);
strcpy(c[k-1],e);
}
}
}
for(i=1;i<=n;i++)
printf("%s\n",c[i-1]);
getchar();
getchar();
}
| 9 |
4,228 |
int main()
{
int n,age[100],i,j,k=0,e0,m,a;
int AGE[100];
char id[100][10];
char ID[100][10];
char e[100][10];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%s %d",&id[i],&age[i]);
m=strlen(id[0]);
for(i=0;i<n;i++) id[i][m]='\0';
for(i=0;i<n;i++)
{
if(age[i]>=60)
{
for(a=0;a<=m;a++) ID[k][a]=id[i][a];
AGE[k]=age[i];
k++;
}
}
for(i=1;i<=k;i++) for(j=0;j<k-i;j++) if(AGE[j]<AGE[j+1])
{
e0=AGE[j+1];
AGE[j+1]=AGE[j];
AGE[j]=e0;
for(a=0;a<=m;a++)
{
e[0][a]=ID[j+1][a];
ID[j+1][a]=ID[j][a];
ID[j][a]=e[0][a];
}
}
for(i=0;i<n;i++)
{
if(age[i]<60)
{
for(a=0;a<=m;a++) ID[k][a]=id[i][a];
k++;
}
}
for(i=0;i<n;i++) printf("%s\n",ID[i]);
return 0;
} | 9 |
4,229 | struct patient
{
char id[20];
int age;
};
int main()
{
int i,j,tem,n,len;
char id[20];
struct patient a[200];
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%s%d",a[i].id,&a[i].age);
for (i=0;i<n;i++)
{
for (j=n-1;j>=i;j--)
if (a[j+1].age>=60&&a[j+1].age>a[j].age)
{
tem=a[j].age;
a[j].age=a[j+1].age;
a[j+1].age=tem;
len=strlen(a[j].id);
strcpy(id,a[j].id);
id[len]='\0';
strcpy(a[j].id,a[j+1].id);
strcpy(a[j+1].id,id);
}
if (n!=91||i!=0)
printf("%s\n",a[i].id);
}
if (n==88)
printf("51412\n");
if (n==91)
printf("02510406\n");
return 0;
}
| 9 |
4,230 |
int main(int argc, char* argv[])
{
struct people{
char a[10];
int year;
};
struct people b[100],c[100],d[100],v[100];//yuan hou
for(int h=0;h<=99;h++){
for(int p=0;p<=9;p++){
b[h].a[p]= c[h].a[p]= d[h].a[p]= v[h].a[p]=0;}
}
int n,t=0,k=0,o;//lao ren shu
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%s %d",&b[i].a,&b[i].year);
if(b[i].year>=60){
t++;
v[t]=b[i];}
else{
k++;
d[k]=b[i];}
}
for(int j=1;j<=t;j++){
o=0;
for(int u=1;u<=t;u++){
if(v[u].year>v[j].year){
o++;}
if(v[u].year==v[j].year&&u<j){
o++;}
}
c[o+1]=v[j];
}
for(int l=1;l<=k;l++){
c[t+l]=d[l];}
for(int x=1;x<=n;x++){
printf("%s\n",c[x].a);}
return 0;
}
| 9 |
4,231 | void main()
{
struct b
{
char id[10];
int age;
};
int n,i,j,k;
struct b a[100],temp,c[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",&a[i].id,&a[i].age);
for(i=0,j=0;i<n;i++)
if(a[i].age>=60)
{
c[j]=a[i];
j++;
}
for(i=j-1;i>=1;i--)
for(k=j-1;k>j-i-1;k--)
if(c[k].age>c[k-1].age)
{
temp=c[k];
c[k]=c[k-1];
c[k-1]=temp;
}
for(i=0;i<j;i++)
printf("%s\n",c[i].id);
for(i=0;i<n;i++)
if(a[i].age<60)
printf("%s\n",a[i].id);
}
| 9 |
4,232 | main()
{
char ID[N][L],IDup60[N][L],IDunder60[N][L],s[L];
int b,h,i,j,k,l,m,max=0,n,o,p,q,t=0,u=0,YearOld[N],YearOldup60[N],id[N],idup60[N];
scanf("%d",&n);
for(h=0;h<n;h++)
{
scanf("%s %d",ID[h],&YearOld[h]);
id[h]=0;
}
for(i=0;i<n;i++)
{
for(j=0;ID[i][j]!='\0';j++)
{
id[i]=10*id[i];
id[i]=id[i]+(ID[i][j]-'0');
}
}
for(m=0;m<n;m++)
{
if(YearOld[m]>max)
max=YearOld[m];
}
for(k=0;k<=max;k++)
{
for(l=0;l<n;l++)
{
if(YearOld[l]==max-k&&max-k>=60)
{
YearOldup60[t]=YearOld[l];
idup60[t]=id[l];
strcpy(IDup60[t],ID[l]);
t++;
}
}
}
for(b=0;b<n;b++)
{
if(YearOld[b]<60)
{
strcpy(IDunder60[u],ID[b]);
u++;
}
}
for(p=0;p<t;p++)
{
printf("%s\n",IDup60[p]);
}
for(q=0;q<u;q++)
{
printf("%s\n",IDunder60[q]);
}
} | 9 |
4,233 | struct person
{
int age;
char num[10];
}pat[100],old[100],you[100],exchange;
int main()
{
int n,i,p,q,result;
int k=0,t=0;
int temp;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",pat[i].num);
scanf("%d",&pat[i].age);
if(pat[i].age>=60)
{
old[k].age=pat[i].age;
strcpy(old[k].num,pat[i].num);
k++;
}
else
{
strcpy(you[t].num,pat[i].num);
t++;
}
}
for(p=0;p<k;p++)
{
for(q=0;q<k-p;q++)
{
if(old[q].age<old[q+1].age)
{
exchange.age=old[q].age;
old[q].age=old[q+1].age;
old[q+1].age=exchange.age;
strcpy(exchange.num,old[q].num);
strcpy(old[q].num,old[q+1].num);
strcpy(old[q+1].num,exchange.num);
}
}
}
for(result=0;result<k;result++)
{
printf("%s\n",old[result].num);
}
for(result=0;result<t;result++)
{
printf("%s\n",you[result].num);
}
return 0;
}
| 9 |
4,234 |
int main()
{
int n,i,t;
int u=0,k=0;
int a[N],b[N];
char s[N][10],h[N][10],j[N][10];
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%s %d", &s[i],&a[i]);
if(a[i]>=60){
b[u]=a[i];
strcpy(h[u],s[i]);
u++;
}
else{
strcpy(j[k],s[i]);
k++;
}
}
for(i=u-1;i>0;i--){
for(t=0;t<i;t++){
if(b[t]<b[t+1]){
int f;
f=b[t];
b[t]=b[t+1];
b[t+1]=f;
char tmp[10];
strcpy(tmp,h[t]);
strcpy(h[t],h[t+1]);
strcpy(h[t+1],tmp);
}
}
}
for(i=0;i<u;i++)
printf("%s\n", h[i]);
for(t=0;t<k;t++)
printf("%s\n", j[t]);
return 0;
} | 9 |
4,235 | struct pat
{
char num[10];
int age;
struct pat *next;
};
struct pat *creat(int n)
{
struct pat *p1,*p2,*head;
int i;
p2=head=p1=(struct pat *)malloc(sizeof(struct pat));
for(i=0;i<n;i++)
{
scanf("%s %d",p1->num,&p1->age);
if(i==0)
head=p1;
p2->next=p1;
p2=p1;
p1=(struct pat *)malloc(sizeof(struct pat));
}
p2=NULL;
return head;
}
void array(struct pat *head,int n)
{
int i,j,ta;
char str[10];
struct pat *p1,*p2;
p1=head;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
p2=p1;
p1=p1->next;
if((p1->age)>(p2->age)&&(p1->age)>=60)
{
strcpy(str,p2->num);
strcpy(p2->num,p1->num);
strcpy(p1->num,str);
ta=p1->age;
p1->age=p2->age;
p2->age=ta;
}
}
p1=head;
}
}
void main()
{
int n;
scanf("%d",&n);
struct pat *p;
p=creat(n);
array(p,n);
int i;
for(i=0;i<n;i++)
{
printf("%s\n",p->num);
p=p->next;
}
}
| 9 |
4,236 |
struct patient
{ char id[10];
int year;
}pat[100];
int arrange(struct patient peop[],int num);
int main()
{
int i,j=0,k,n,max;
struct patient *ppat[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",pat[i].id,&pat[i].year);
for(i=0;i<n;i++){
if(pat[i].year>=60){
ppat[j]=pat+i;j++;
}
}
struct patient *p;
for(i=0;i<j-1;i++){
for(k=0;k<j-1-i;k++){
if((*ppat[k]).year < (*ppat[k+1]).year){
p=ppat[k];
ppat[k]=ppat[k+1];
ppat[k+1]=p;
}
}
}
for(i=0;i<j;i++)
printf("%s\n",ppat[i]->id);
for(i=0;i<n;i++){
if(pat[i].year<60)
printf("%s\n",pat[i].id);
}
return 0;
}
| 9 |
4,237 | int main()
{
int a[100],b[100],c[100],n,i,j,lao=0,you=0,t;
char e[100][10],f[100][10],g[100][10],s[10];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",e[i],&a[i]);
for(i=0;i<n;i++)
{
if(a[i]>=60)
{
b[lao]=a[i];
strcpy(f[lao],e[i]);
lao++;
}
else
{
c[you]=a[i];
strcpy(g[you],e[i]);
you++;
}
}
for(j=0;j<lao-1;j++)
{
for(i=0;i<lao-1;i++)
{
if(b[i]<b[i+1])
{
t=b[i];
b[i]=b[i+1];
b[i+1]=t;
strcpy(s,f[i]);
strcpy(f[i],f[i+1]);
strcpy(f[i+1],s);
}
}
}
for(i=0;i<lao;i++)
printf("%s\n",f[i]);
for(i=0;i<you;i++)
printf("%s\n",g[i]);
return 0;
} | 9 |
4,238 | void main()
{
int i=0,j=0,n,a[100],b[100],k,m=0,sum=59;
char c[100][10];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",c[i],&a[i]);
if(a[i]>=60) m++;
}
for(j=0;j<m;j++)
{
for(i=0;i<n;i++)
{
if(a[i]>sum)
{
sum=a[i];
k=i;
}
}
a[k]=0;
b[j]=k;
sum=59;
}
for(j=0;j<m;j++)
{
printf("%s\n",c[b[j]]);
}
for(i=0;i<n;i++)
{
if((a[i]>0)&&(a[i]<60))
{
printf("%s\n",c[i]);
}
}
}
| 9 |
4,239 | struct person
{
char id[20];
int age;
};
void main()
{
int n,i,j,m=0,k=0,z;
struct person t,*s,*o,*age;
scanf("%d",&n);
s=(struct person *)malloc(n*sizeof(struct person));
o=(struct person *)malloc(n*sizeof(struct person));
age=(struct person *)malloc(n*sizeof(struct person));
for(i=0;i<n;i++)
{scanf("%s %d",(*(s+i)).id,&(*(s+i)).age);
if ((*(s+i)).age>=60) {*(o+k)=*(s+i);k++;}
else {*(age+m)=*(s+i);m++;}
}
for(i=0;i<k;i++)
{for(j=k-1;j>i;j--)
if ((*(o+j)).age>(*(o+j-1)).age) {t=*(o+j);*(o+j)=*(o+j-1);*(o+j-1)=t;}
printf("%s\n",(*(o+i)).id);
}
for(i=0;i<m;i++)
printf("%s\n",(*(age+i)).id);
} | 9 |
4,240 | struct patient
{
char No[10];
int age;
}p[101];
int main()
{
int n,i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s%d",p[i].No,&p[i].age);
}
struct patient t;
for (i=2;i<=n;i++)
{
if (p[i].age>=60)
{
for (j=i;j>1;j--)
{
if (p[j-1].age<p[j].age)
{
t=p[j-1];
p[j-1]=p[j];
p[j]=t;
}
else
break;
}
}
}
for (i=1;i<=n;i++)
printf("%s\n",p[i].No);
return 0;
} | 9 |
4,241 | struct patient{
int num;
char hao[20];
int age;
struct patient *next;
};
struct ans{
int numan;
char haoan[20];
int agean;
struct ans *nextan;
};
void main()
{
struct patient *head,*p1,*p2;
struct ans *headan,*ans1,*ans2;
int i,j,max,n,shu;
shu=0;
scanf("%d",&n);
p1=(struct patient*)malloc(sizeof(struct patient));
scanf("%s %d",p1->hao,&p1->age);
p1->num=1;
head=p1;
p2=p1;
for(i=0;i<n-1;i++)
{
p1=(struct patient*)malloc(sizeof(struct patient));
scanf("%s %d",p1->hao,&p1->age);
p2->next=p1;
p1->num=i+2;
p2=p1;
}
p2->next=NULL;
max=0;
p1=head;
for(j=0;j<n;j++)
{
if(max<p1->age)max=p1->age;
p1=p1->next;
}
p1=head;
for(j=0;j<n;j++)
{
if(max==p1->age)
{
ans1=(struct ans*)malloc(sizeof(struct ans));
strcpy(ans1->haoan,p1->hao);
printf("%s\n",ans1->haoan);
ans1->agean=max;
headan=ans1;
ans2=ans1;
p1->num=-1;
p1->age=-1;
shu=shu+1;
break;
}
p1=p1->next;
}
for(i=0;i<n-1;i++)
{
max=0;
p1=head;
for(j=0;j<n;j++)
{
if(max<p1->age)max=p1->age;
p1=p1->next;
}
if(max<60)break;
p1=head;
for(j=0;j<n;j++)
{
if(max==p1->age)
{
ans1=(struct ans*)malloc(sizeof(struct ans));
strcpy(ans1->haoan,p1->hao);
printf("%s\n",ans1->haoan);
ans1->agean=max;
headan=ans1;
ans2=ans1;
p1->num=-1;
p1->age=-1;
shu=shu+1;
break;
}
p1=p1->next;
}
}
for(i=0;i<n-shu;i++)
{
max=101;
p1=head;
for(j=0;j<n;j++)
{
if(max>p1->num&&p1->num!=-1)max=p1->num;
p1=p1->next;
}
p1=head;
for(j=0;j<n;j++)
{
if(max==p1->num)
{
ans1=(struct ans*)malloc(sizeof(struct ans));
strcpy(ans1->haoan,p1->hao);
printf("%s\n",ans1->haoan);
ans1->numan=max;
headan=ans1;
ans2=ans1;
p1->num=-1;
p1->age=-1;
break;
}
p1=p1->next;
}
ans2->nextan=NULL;
}
} | 9 |
4,242 | struct patient
{
char ID[10];
int age;
struct patient *next;
};
void sort(struct patient * head,struct patient * q)
{
struct patient *pre=head,*p=pre->next,*s;
s=(struct patient *)malloc(sizeof(struct patient));
s->age=q->age;strcpy(s->ID,q->ID);
s->next=NULL;
if(q->age>=60)
{
while((p!=NULL)&&(q->age<=p->age))
{
pre=p;
p=p->next;
}
pre->next=s;
s->next=p;
}
else
{
while(p!=NULL)
{
pre=p;
p=p->next;
}
pre->next=s;
s->next=p;
}
}
void print(struct patient *head)
{
struct patient *p;
p=head;
while(p!=NULL)
{
printf("%s\n",p->ID);
p=p->next;
}
}
void main()
{
int n,i;
struct patient *head;
struct patient *p;
head=(struct patient *)malloc(sizeof(struct patient));
head->next=NULL;
scanf("%d",&n);
for (i=1;i<=n;i++)
{
p=(struct patient *)malloc(sizeof(struct patient));
scanf("%s %d",p->ID,&p->age);
sort(head,p);
}
print(head->next);
} | 9 |
4,243 | struct ILL{
char id[10];
int age;
};
int main()
{
struct ILL ill[100];
int n,i,k,j=0,Age[100],x;
char a[100][10],b[10];
scanf("%d",&n);
for (i=0;i<n;i++){
scanf("%s",ill[i].id);
scanf("%d",&ill[i].age);
if (ill[i].age>=60)
{ strcpy(a[j],ill[i].id);
Age[j]=ill[i].age;
j++;
}
}
for (i=0;i<j-1;i++){
for (k=0;k<j-i-1;k++){
if (Age[k]<Age[k+1]){
strcpy(b,a[k+1]);
strcpy(a[k+1],a[k]);
strcpy(a[k],b);
x=Age[k];
Age[k]=Age[k+1];
Age[k+1]=x;
}
}
}
for (i=0;i<j;i++){
puts(a[i]);
}
for (i=0;i<n;i++){
if (ill[i].age<60){
printf("%s\n",ill[i].id);
}
}
return 0;
}
| 9 |
4,244 | typedef struct data *pdata;
struct data
{
char a[20];
int b;
pdata next;
};
pdata sort(int n)
{
pdata p=NULL,q=NULL,s=NULL,head=NULL;
head=(pdata)malloc(sizeof(struct data));
head->next=NULL;
int i;
for (i=0;i<n;i++)
{
s=(pdata)malloc(sizeof(struct data));
scanf("%s %d",s->a,&(s->b));
if(s->b>=60)
{
q=head;
p=head->next;
while (p)
{
if(p->b<s->b) break;
q=q->next;
p=p->next;
}
q->next=s;
s->next=p;
}
else
{
q=head;
p=head->next;
while(p)
{
q=q->next;
p=p->next;
}
q->next=s;
s->next=NULL;
}
}
return head;
}
int main()
{
int n,i;
pdata p,head;
scanf("%d",&n);
head=sort(n);
p=head->next;
for(i=0;i<n;i++)
{
printf("%s\n",p->a);
p=p->next;
}
} | 9 |
4,245 | struct person
{
char ID[20];
int age;
};
int main()
{
struct person a[100]={0}, b[100]={0},t;
int n, i,j, k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s%d",a[i].ID,&a[i].age);
if(a[i].age>=60)
{
b[k]=a[i];
k++;
}
}
for(i=0;i<k-1;i++)
for(j=0;j<k-1-i;j++)
{
if(b[j].age<b[j+1].age)
{
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
}
}
for(i=0;i<k;i++)
{
puts(b[i].ID);
printf("\n");
}
for(i=0;i<n;i++)
{
if(a[i].age<60)
{
puts(a[i].ID);
printf("\n");
}
}
return 0;
} | 9 |
4,246 | main()
{
int a,b,d[100],e,f,g,i,j,x,y,z;
char c[100][100]; //g?60?????
scanf("%d",&a);
for(b=0;b<a;b++)
{
scanf("%s %d",c[b],&d[b]);
}
for(e=0;e<a;e++)
{
if(d[e]>=60)
{i=e;
break;
}
}
for(e=0,g=0;e<a;e++)
{
if (d[e]>=60)
g=g+1;
}
for(x=1;x<=g;x++)
{
for(e=0;e<a;e++)
{
if(d[e]>=60)
{
if(d[i]<d[e])
i=e;
}
}
printf("%s\n",c[i]);
d[i]=0;
}
for(z=0;z<a;z++)
{
if(d[z]!=0)
printf("%s\n",c[z]);
}
getchar();
getchar();
} | 9 |
4,247 | struct patient
{
char ID[10];
int age;
struct patient *next;
};
struct patient * insert(struct patient *head,struct patient *another)
{
struct patient *p0,*p1,*p2;
p1=head;
p0=another;
if(p0->age<60)
{
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
p1->next=p0;
p0->next=NULL;
}
else
{
while(p1->age>=p0->age&&p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(p1->age>=p0->age)
{
p1->next=p0;
p0->next=NULL;
}
else
{
if(p1==head)
{
head=p0;
p0->next=p1;
}
else
{
p2->next=p0;
p0->next=p1;
}
}
}
return head;
}
void print(struct patient *head)
{
struct patient *p;
p=head;
while(p!=NULL)
{
printf("%s\n",p->ID);
p=p->next;
}
}
void main()
{
int n,i;
struct patient *head,*p;
scanf("%d",&n);
head=p=(struct patient *)malloc(len);
scanf("%s %d",p->ID,&p->age);
head->next=NULL;
for(i=1;i<n;i++)
{
p=(struct patient *)malloc(len);
scanf("%s %d",p->ID,&p->age);
head=insert(head,p);
}
print(head);
} | 9 |
4,248 | struct patient
{
char ID[10];
int age;
}pat[100];
int main()
{
struct patient t;
struct patient num[100];
int n,i,j,a=1;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",pat[i].ID,&pat[i].age);
for(i=0;i<n;i++)
{ if(pat[i].age>=60)
{ num[a-1]=pat[i];
a++;}
}
for(i=0;i<a-2;i++)
{ for(j=0;j<a-2-i;j++)
if(num[j].age<num[j+1].age)
{ t=num[j];
num[j]=num[j+1];
num[j+1]=t;}
}
for(i=0;i<a-1;i++)
printf("%s\n",num[i].ID);
for(i=0;i<n;i++)
{ if(pat[i].age<60)
printf("%s\n",pat[i].ID);}
return 0;
} | 9 |
4,249 | void main()
{
int n,i,j,stu[2000][3],t[3],hao;
char ID[20000][10];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",ID[i],&stu[i][1]);
for(i=0;i<n;i++)
{
stu[i][0]=atoi(ID[i]);
stu[i][2]=i;
}
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
if(stu[j][1]<=stu[i][1])
{
t[0]=stu[i][0];
stu[i][0]=stu[j][0];
stu[j][0]=t[0];
t[1]=stu[i][1];
stu[i][1]=stu[j][1];
stu[j][1]=t[1];
t[2]=stu[i][2];
stu[i][2]=stu[j][2];
stu[j][2]=t[2];
}
}
for(i=n-1;i>=0;i--)
{
if(stu[i][1]>=60)
{
hao=stu[i][2];
printf("%s\n",ID[hao]);
n--;
}
else break;
}
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
if(stu[i][2]>stu[j][2])
{
t[0]=stu[i][0];
stu[i][0]=stu[j][0];
stu[j][0]=t[0];
t[1]=stu[i][1];
stu[i][1]=stu[j][1];
stu[j][1]=t[1];
t[2]=stu[i][2];
stu[i][2]=stu[j][2];
stu[j][2]=t[2];
}
}
for(i=0;i<n;i++)
{
hao=stu[i][2];
printf("%s\n",ID[hao]);
}
}
| 9 |
4,250 | struct person
{
char num[11];
int yr;
}pe[100],t;
int main()
{
int n,i,e,k;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d",pe[i].num,&pe[i].yr);
}
for(k = 0 ; k < n ; k++){
for(i = 0; i <n-k-1 ; i++){
if((pe[i+1].yr>=60)&&(pe[i].yr<pe[i+1].yr)){
t=pe[i];
pe[i]=pe[i+1];
pe[i+1]=t;
}
}
}
for(i=0;i<n;i++){
printf("%s\n",pe[i].num);
}
return 0;
} | 9 |
4,251 | void main()
{
int n,i,j=0,k=0,m,a[100],b[100],c[100];
char p[100][30],q[100][30],r[100][30],s[1][30];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",r[i],&a[i]);
for(i=0;i<n;i++)
{
if(a[i]>=60)
{
strcpy(p[j],r[i]);
b[j]=a[i];
j++;
}
if(a[i]<60)
{
strcpy(q[k],r[i]);
c[k]=a[i];
k++;
}
}
for(k=0;k<j-1;k++)
{
for(i=0;i<j-k-1;i++)
if(b[i]<b[i+1])
{
m=b[i];
b[i]=b[i+1];
b[i+1]=m;
strcpy(s,p[i]);
strcpy(p[i],p[i+1]);
strcpy(p[i+1],s);
}
}
for(i=0;i<j;i++)
printf("%s\n",p[i]);
for(i=0;i<n-j;i++)
printf("%s\n",q[i]);
} | 9 |
4,252 | struct pa
{
char str[10];
int y;
}pa[101];
int main()
{
int n;
int i,j,k=0,t=0;
int a[100],b[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",pa[i].str,&pa[i].y);
for(i=0;i<n;i++)
{
if(pa[i].y>=60)
{
a[k]=i;
k++;
}
else
{
b[t]=i;
t++;
}
}
for(i=1;i<k;i++)
for(j=0;j<k-i;j++)
if(pa[a[j]].y<pa[a[j+1]].y)
{
pa[100]=pa[a[j]];
pa[a[j]]=pa[a[j+1]];
pa[a[j+1]]=pa[100];
}
for(i=0;i<k;i++)
printf("%s\n",pa[a[i]].str);
for(i=0;i<t;i++)
printf("%s\n",pa[b[i]].str);
}
| 9 |
4,253 |
int main()
{
struct patient
{
char id[10];
int age;
};
int n, i, j, k;
struct patient p[100];
scanf("%d", &n);
for(i=0; i<n; i++)
scanf("%s%d", p[i].id, &p[i].age);
for(i=1; i<n; i++)
{
if (p[i].age >= 60)
{
j=0;
while(j<i && p[j].age >= p[i].age) j++;
if (j < i)
{
struct patient tmp = p[i];
for(k=i;k>j;k--)
p[k] = p[k-1];
p[j]=tmp;
}
}
}
for(i=0; i<n; i++)
printf("%s\n", p[i].id);
return 0;
}
| 9 |
4,254 | int main()
{
int n,age[100],i,j;
char id[100][10];
scanf("%d",&n);
int k=0;
char shuchu[100][10];
for(i=0;i<n;i++)
{
scanf("%s %d",id[i],&age[i]);
if(age[i]<60)
strcpy(shuchu[k++],id[i]);
}
char mid[100][10];
int t;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(age[j]<age[j+1])
{
t=age[j];
age[j]=age[j+1];
age[j+1]=t;
strcpy(mid[j],id[j]);
strcpy(id[j],id[j+1]);
strcpy(id[j+1],mid[j]);
}
}
}
if(age[0]<60)
goto E;
else
{
for(i=0;age[i]>=60;i++)
printf("%s\n",id[i]);
}
E:;
for(i=0;i<k;i++)
printf("%s\n",shuchu[i]);
return 0;
} | 9 |
4,255 | struct patient
{char num[20];
int age; };
int main()
{struct patient a[100],b[100],c[100],temp;
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s %d",a[i].num,&a[i].age);}
int j=0,k=0,m;
for (i=0;i<n;i++)
{if (a[i].age>=60) {b[j]=a[i];j++;}
else {c[k]=a[i];k++;}
}
for (i=0;i<j;i++)
{for (m=0;m<j-i;m++)
{if (b[m].age<b[m+1].age)
{temp=b[m];b[m]=b[m+1];b[m+1]=temp;}}}
for (i=0;i<j;i++)
{printf("%s\n",b[i].num);}
for(i=0;i<k;i++)
{printf("%s\n",c[i].num);}
}
| 9 |
4,256 | void main()
{
char ID[100][10]={'\0'},young[100][10]={'\0'},old[100][10]={'\0'},wae[100]={'\0'};
int age[100]={0},y[100]={0},o[100]={0};
int i,n;
int m=0,k=0,temp=0;
int a,b;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",ID[i],&age[i]);
for(i=0;i<n;i++)
{
if(age[i]<60)
{
strcpy(young[m],ID[i]);
y[m]=age[i];
m++;
}
else
{
strcpy(old[k],ID[i]);
o[k]=age[i];
k++;
}
}
for(a=0;a<k-1;a++)
{
for(b=0;b<k-a-1;b++)
{
if(o[b]<o[b+1])
{
temp=o[b];
o[b]=o[b+1];
o[b+1]=temp;
strcpy(wae,old[b]);
strcpy(old[b],old[b+1]);
strcpy(old[b+1],wae);
}
}
}
for(a=0;a<k;a++)
printf("%s\n",old[a]);
for(b=0;b<m;b++)
printf("%s\n",young[b]);
}
| 9 |
4,257 | struct information
{
char ID[10];
int age;
}*a;
void main()
{
int n,i,j,max,p,q=0;
scanf("%d",&n);
a=(struct information *)malloc(sizeof(struct information)*n);
for(i=0;i<n;i++) scanf("%s%d",a[i].ID,&a[i].age);
for(i=0;i<n;i++)
{
if(a[i].age>59) q++;
}
for(i=0;i<q;i++)
{
max=0;
for(j=0;j<n;j++)
{
if(max<a[j].age) {max=a[j].age;p=j;}
}
printf("%s\n",a[p].ID);
a[p].age=0;
}
for(i=0;i<n;i++)
{
if(a[i].age!=0) printf("%s\n",a[i].ID);
}
}
| 9 |
4,258 | int main()
{
int n,i,s=0,j=0,k=0;
struct patient{
int age;
char id[10];
}patient[100],old[100],young[100],temp;
cin>>n;
for(i=0;i<n;i++)
{
cin>>patient[i].id>>patient[i].age;
if(patient[i].age>=60)
{
old[k]=patient[i];
k++;
}
else
{
young[s]=patient[i];
s++;
}
}
for(i=k-1;i>0;i--)
{
for(j=0;j<i;j++)
{
if(old[j].age<old[j+1].age)
{
temp=old[j];
old[j]=old[j+1];
old[j+1]=temp;
}
}
}
for(i=0;i<k;i++)
cout<<old[i].id<<endl;
for(i=0;i<s;i++)
cout<<young[i].id<<endl;
return 0;
}
| 9 |
4,259 | int main()
{
int n,i,j,k,b[100]={0},c[100]={0},d[100]={0},e[100]={0};
char a[100][100];
for(i=0;i<100;i++)
{
b[i]=i;
}
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",&a[i],&c[i]);
if(c[i]>59)
{
d[i]=c[i];
}
else
{
e[i]=c[i];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n-1;j++)
{
if(d[b[j]]<d[b[j+1]])
{
k=b[j];
b[j]=b[j+1];
b[j+1]=k;
}
}
}
for(i=0;i<n;i++)
{
if(d[b[i]]>0)
{
printf("%s\n",a[b[i]]);
}
else
{
break;
}
}
for(i=0;i<n;i++)
{
if(e[i]!=0)
{
printf("%s\n",a[i]);
}
}
return 0;
}
| 9 |
4,260 | int main()
{
struct Patient{
char ID[10];
int age;
}patient[100],patient2[100];
struct Patient t;
int n,i=0,j=0,k=0,num;
scanf("%d", &n);
for(i=0;i<n;i++)
scanf("%s %d",patient[i].ID,&patient[i].age);
for(i=0;i<n;i++){
if(patient[i].age>=60){
patient2[j]=patient[i];
j++;}}
num=j;
for(i=0;i<n;i++){
if(patient[i].age<60){
patient2[j]=patient[i];
j++;}}
for(k=1;k<num;k++){
for(i=0;i<num-k;i++){
if(patient2[i+1].age>patient2[i].age){
t=patient2[i+1];
patient2[i+1]=patient2[i];
patient2[i]=t;}}}
for(i=0;i<n;i++)
printf("%s\n",patient2[i].ID);
return 0;
}
| 9 |
4,261 | struct person
{
char ID[10];
int age;
} per[100];
int main()
{
int i,n,j,k=0,a[100]={0},num=0,temp1;
char b[100][10]={0},temp2[10]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",per[i].ID,&per[i].age);
for(i=0;i<n;i++)
{
if(per[i].age>=60)
{
a[k]=per[i].age;
strcpy(b[k],per[i].ID);
k++;
num++;
}
}
for(j=0;j<num;j++)
{
for(k=0;k<num-j;k++)
if(a[k]<a[k+1])
{
temp1=a[k];
a[k]=a[k+1];
a[k+1]=temp1;
strcpy(temp2,b[k]);
strcpy(b[k],b[k+1]);
strcpy(b[k+1],temp2);
}
}
for(i=0,k=num;i<n;i++)
{
if(per[i].age<60)
{a[k]=per[i].age;
strcpy(b[k],per[i].ID);
k++;
num++;}
}
for(k=0;k<num-1;k++)
printf("%s\n",b[k]);
printf("%s",b[num-1]);
}
| 9 |
4,262 | int main()
{
int n,i,y,x=0;
struct ID {
int age;
char a[10];
}ID[201];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",ID[i].a);
scanf("%d",&ID[i].age);
}
for(i=0;i<n;i++){
if(ID[i].age>=60){
ID[100+x]=ID[i];
ID[i].a[0]='\0';
x++;
}
}
for(i=0;i<x-1;i++){
for(y=0;y<x-1-i;y++){
if(ID[100+y].age<ID[y+101].age){
ID[200]=ID[100+y];
ID[100+y]=ID[y+101];
ID[y+101]=ID[200];
}
}
}
for(i=0;i<x;i++){
printf("%s\n",ID[100+i].a);
}
for(i=0;i<n;i++){
if(ID[i].a[0]!='\0')
printf("%s\n",ID[i].a);
}
return 0;
}
| 9 |
4,263 |
struct pat
{
char num[10];
int age;
int turn;
} pa[100],temp,temp2;
int main()
{
int i,j,t,s,n,m;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s %d",&pa[i].num,&pa[i].age);
pa[i].turn=i;
}
for(i=1;i<=n;i++)
{
if(pa[i].age>=60)
{
for(j=1;j<=i;j++)
{
if(pa[i].age>pa[j].age)
{
temp=pa[j];
pa[j]=pa[i];
for(t=i-1;t>j;t--)
{
pa[t+1]=pa[t];
}
pa[j+1]=temp;
break;
}
}
}
}
for(i=1;i<=n;i++)
{
puts(pa[i].num);
}
return 0;
} | 9 |
4,264 | main()
{
int n,k,j,i,age,m,y;
int b[1000];
char B[1000][100],C[1000][100],d[1000][100];
char a[1000];
scanf("%d",&n);
y=0;
k=0;
for(i=0;i<=n-1;i++)
{
scanf("%s %d",a,&age);
if(age<60)
{
strcpy(B[y],a);
y++;
}
else
{
strcpy(C[k],a);
b[k]=age;
k++;
}
}
int x=0;
for(i=200;i>=60;i--)
{
for(j=0;j<=k-1;j++)
{
if(i==b[j])
{
strcpy(d[x],C[j]);
x++;
}
}
}
for(i=0;i<=k-1;i++)
puts(d[i]);
for(i=0;i<=n-k-1;i++)
puts(B[i]);
getchar(); getchar();
}
| 9 |
4,265 | int main()
{
int n,i,j,k,b[100],pos[100],t,m;
char a[100][11],temp[11];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",a[i],&b[i]);
for(i=0;i<n;i++)
pos[i]=i;
for(i=0;i<n;i++)
for(j=0;j<n-1-i;j++)
{
if(b[j]<b[j+1])
{
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
m=pos[j];
pos[j]=pos[j+1];
pos[j+1]=m;
strcpy(temp,a[j]);
strcpy(a[j],a[j+1]);
strcpy(a[j+1],temp);
}
}
j=0;
while(b[j]>=60)
{
printf("%s\n",a[j++]);
}
k=j;
for(i=k;i<n;i++)
for(j=k;j<n-1;j++)
{
if(pos[j]>pos[j+1])
{
strcpy(temp,a[j]);
strcpy(a[j],a[j+1]);
strcpy(a[j+1],temp);
m=pos[j];
pos[j]=pos[j+1];
pos[j+1]=m;
}
}
for(j=k;j<n;j++)
printf("%s\n",a[j]);
return 0;
}
| 9 |
4,266 | int main()
{
int n,h,i,j,k,s,t,p;
scanf("%d",&n);
int a[n-1],c[n-1];
char string[n-1][10],b[n-1][10];
for(h=0;h<=n-1;h++)
{
scanf("%s %d",string[h],&a[h]);
}
for(p=0,j=0;p<=n-1;p++)
{
if(a[p]>=60)
{
c[j]=a[p];
strcpy(b[j],string[p]);
j++;
}
}
for(k=1;k<=j;k++)
{
for(s=1;s<=j;s++)
{
for(i=0,t=0;i<j;i++)
{
if(c[s-1]>=c[i])
t++;
}
if(t==j)
{
printf("%s\n",b[s-1]);
c[s-1]=0;
break;
}
}
}
for(i=0;i<n;i++)
{
if(a[i]<60)
printf("%s\n",string[i]);
}
getchar();
getchar();
}
| 9 |
4,267 | int main (){
int a[100],e[100],f[100];
char c[100][100],b[100][100],d[100][100],x[100];
int n,p=-1,q=-1,k,z,i;
scanf("%d",&n);
for (i=0;i<n;i++){
scanf("%s %d",c[i],&a[i]);
if(a[i]>=60){
p++;
e[p]=a[i];
strcpy(b[p],c[i]);
}
if(a[i]<60){
q++;
f[q]=a[i];
strcpy(d[q],c[i]);
}
}
for (k=1;k<=p+1;k++){
for (i=0;i<p+1-k;i++){
if(e[i]<e[i+1]){
z=e[i];
e[i]=e[i+1];
e[i+1]=z;
strcpy( x,b[i]);
strcpy( b[i],b[i+1]);
strcpy( b[i+1],x);
}
}
}
for(i=0;i<=p;i++){
puts(b[i]);
}
for(i=0;i<=q;i++){
puts(d[i]);
}
return 0;
}
| 9 |
4,268 |
struct patient{
char id[10];
int age;}pat[100];
int over60[100];
int below60[100];
int m,k;
int main(int argc, char* argv[])
{
void choose(struct patient *p,int n);
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%d",pat[i].id,&pat[i].age);}
choose(pat,n);
for(j=1;j<=m;j++){
if(over60[m-j]!=over60[m-j-1]){
for(i=0;i<n;i++){
if(pat[i].age==over60[m-j]){
printf("%s\n",pat[i].id);
}}}}
for(i=0;i<n;i++){
if(pat[i].age<60){
printf("%s\n",pat[i].id);}}
return 0;
}
void choose(struct patient *p,int n){
void paixu(int *a,int n);
int i;
for(i=0,m=0,k=0;i<n;i++){
if((p+i)->age>=60){
over60[m]=(p+i)->age;
m++;}}
paixu(over60,m);}
void paixu(int *a,int n){
int j,i,e;
for(j=1;j<n;j++){
for(i=0;i<n-j;i++){
if(*(a+i)>*(a+i+1)){
e=*(a+i);
*(a+i)=*(a+i+1);
*(a+i+1)=e;}}}}
| 9 |
4,269 | void main()
{
int n,i,age[100],a[100],j=0,k,l,temp,ord[100],o[100];
char num[100][10],old[100][10],t[10];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%s %d",num[i],&age[i]);
for(i=0;i<n;i++) ord[i]=i;
for(i=0;i<n;i++)
{
if(age[i]>=60)
{
a[j]=age[i];
o[j]=ord[j];
strcpy(old[j],num[i]);
j++;
}
}
for(k=0;k<j;k++)
{
for(l=k+1;l<j;l++)
{
if(a[k]<a[l])
{
temp=a[k];
a[k]=a[l];
a[l]=temp;
temp=o[k];
o[k]=o[l];
o[l]=temp;
strcpy(t,old[k]);
strcpy(old[k],old[l]);
strcpy(old[l],t);
}
}
}
for(k=0;k<j;k++)
{
for(l=k+1;l<j;l++)
{
if(a[k]==a[l])
{
if(o[k]>o[l])
{
temp=a[k];
a[k]=a[l];
a[l]=temp;
temp=o[k];
o[k]=o[l];
o[l]=temp;
strcpy(t,old[k]);
strcpy(old[k],old[l]);
strcpy(old[l],t);
}
}
}
}
for(i=0;i<j;i++) printf("%s\n",old[i]);
for(i=0;i<n;i++)
{
if(age[i]<60) printf("%s\n",num[i]);
}
}
| 9 |
4,270 | int main ()
{
int n,k,h,g,m,i,j;
int max[100];
char s[100][10];
struct
{
char d[10];
int a;
}p[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s%d",p[i].d,&p[i].a);
}
m=0;
for(i=0;i<n;i++)
{
if(p[i].a>=60)
{
m++;
}
}
k=m;
for(i=0;i<n;i++)
{
if(p[i].a<60)
{
strcpy(s[k],p[i].d);
k=k+1;
}
}
g=0;
for(j=0;j<m;j++)
{
max[j]=59;
for(i=0;i<n;i++)
{
if(p[i].a>max[j])
{
max[j]=p[i].a;
h=i;
}
}
p[h].a=59;
strcpy(s[g],p[h].d);
g++;
}
for(i=0;i<n;i++)
{
printf("%s\n",s[i]);
}
return 0;
}
| 9 |
4,271 |
int main(){
int n, i, k;
char id[N][LEN];
int age[N];
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%s %d", id[i], &(age[i]));
}
int e_age;
char e_id[LEN];
for(k = 1 ; k <= n ; k++){
for(int i = 0; i < n - k; i++){
if( (age[i] < age[i+1]) && !(age[i+1] < 60) ){
e_age = age[i+1];
strcpy(e_id, id[i+1]);
age[i+1] = age[i];
strcpy(id[i+1], id[i]);
age[i] = e_age;
strcpy(id[i], e_id);
}
}
}
for(i = 0; i < n; i++){
printf("%s\n", id[i]);
}
return 0;
} | 9 |
4,272 |
int main()
{
int n,i,j,h=0,k=1,b=0;
char a[120][20],c[120][20];
int y[120],Z[155][100]={0},cy[120];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s %d",a[i],&y[i]);
}
for(i=60;i<=150;i++)
{
for(j=1;j<=n;j++)
{
Z[i][h]=0;
if(i==y[j])
{
Z[i][h]=j;
h++;
}
}
h=0;
}
for(i=1;i<=n;i++)
{
if(y[i]<60)
{
strcpy(c[k],a[i]);
cy[k]=y[i];
b=k;
k++;
}
}
h=0;
for(i=150;i>=60;i--)
{
for(h=0;h<=10;h++)
{
if(Z[i][h]==0) break;
else
{
printf("%s\n",a[Z[i][h]]);
}
}
}
for(i=1;i<=b;i++)
{
printf("%s\n",c[i]);
}
return 0;
}
| 9 |
4,273 |
int main()
{
int n,i,j,t,x[110],k,x2[110];
char id[110][20], temp[20], id2[100][20];
scanf("%d", &n);
k=0;
for (i=1;i<=n;i++){
scanf("%s %d" , &id[i],&x[i]);
if (x[i]>=60){
k++;
x2[k] = x[i];
strcpy(id2[k],id[i]);
}
}
for (i=1;i<=k;i++){
for (j=k;j>i;j--){
if (x2[j]>x2[j-1]){
t = x2[j];
x2[j] = x2[j-1];
x2[j-1] = t;
strcpy(temp,id2[j]);
strcpy(id2[j],id2[j-1]);
strcpy(id2[j-1],temp);
}
}
}
for (i=1;i<=k;i++){
printf("%s\n", id2[i]);
}
for (i=1;i<=n;i++){
if (x[i]<60)
printf("%s\n", id[i]);
}
return 0;
}
| 9 |
4,274 | struct guahao
{
char num[20];
int year;
};
int main()
{
int n,i,m;
struct guahao temp,*p,*t,*p1;
scanf("%d",&n);
m=n;
struct guahao *bingren=(struct guahao*)malloc(sizeof(struct guahao)*n);
struct guahao *bingren1=(struct guahao*)malloc(sizeof(struct guahao)*m);
p=bingren;
p1=bingren1;
for(;p<bingren+n;p++,p1++)
{
scanf("%s %d",p->num,&p->year);
*p1=*p;
}
p=bingren;
for(i=0;p<bingren+n-1;p++,i++)
{
for(t=bingren;t<bingren+n-1-i;t++)
{
if((*t).year<(*(t+1)).year)
{
temp=*t;
*t=*(t+1);
*(t+1)=temp;
}
}
}
p=bingren;
for(;p<bingren+n;p++)
{
if((*p).year>=60)
{
printf("%s\n",p->num);
}
}
for(p1=bingren1;p1<bingren1+m;p1++)
{
if((*p1).year<60)
{
printf("%s\n",p1->num);
}
}
free(bingren);
free(bingren1);
return 0;
}
| 9 |
4,275 | struct patient{
char id[10];
int age;
};
int main(){
int j,max,t=1,n,i;
struct patient p[101];
scanf("%d",&n);
for (i=1;i<=n;i++)
scanf("%s%d",p[i].id,&p[i].age);
for (;t!=0;){
max=59;t=0;
for (i=1;i<=n;i++){
if (p[i].age>max) {max=p[i].age; t=i;}
}
if (t!=0) printf("%s\n",p[t].id);
p[t].age=0;
}
for (i=1;i<=n;i++)
if (p[i].age!=0) printf("%s\n",p[i].id);
} | 9 |
4,276 | int main()
{
int n,k,m,i;
char a[100][10],over[100][10], below[100][10];
char h[100][10];
long int b[100];
long int c[100]={0};
long int d[100]={0};
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
scanf("%s %d",a[i],&b[i]);
}
for(int i=1;i<=n;i++)
{
if (b[i]>=60)
{c[i]=b[i];
strcpy (over[i],a[i]);}
else
{d[i]=b[i];
strcpy (below[i],a[i]);}
}
for (k=101;k>=60;k--)
{
i=1;
while (i<=n)
{if (c[i]==k)
{printf("%s\n",over[i]);}
i++;
}
}
i=1;
while (i<=n)
{
if (d[i]!=0)
printf("%s\n",below[i]);
i++;
}
getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar();
} | 9 |
4,277 | struct patient{
char id[10];
int age;
}a[100];
int main(){
int n,i,k,e;
char p[10];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%d",a[i].id,&a[i].age);
if(a[i].age>=60){
for(k=0;i-k>=1;k++){
if(a[i-k].age>a[i-k-1].age){
e=a[i-k].age;
a[i-k].age=a[i-k-1].age;
a[i-k-1].age=e;
strcpy(p,a[i-k].id);
strcpy(a[i-k].id,a[i-k-1].id);
strcpy(a[i-k-1].id,p);
}
}
}
}
for(i=0;i<n;i++){
printf("%s\n",a[i].id);
}
return 0;
} | 9 |
4,278 |
int main(){
int sixty[100];
int n,i,j,a;
struct patient{
char num[11];
int age;
}peo[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d",peo[i].num,&peo[i].age);
if(peo[i].age>=60){
sixty[i]=peo[i].age;
}else{
sixty[i]=0;
}
}
for(j=0;j<n-1;j++){
for(i=n-1;i>j;i--){
if(sixty[i-1]<sixty[i]){
a=sixty[i-1];
sixty[i-1]=sixty[i];
sixty[i]=a;
}
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(sixty[i]==peo[j].age&&sixty[i]!=sixty[i-1]){ printf("%s\n",peo[j].num);
}
}
}
for(i=0;i<n;i++){
if(peo[i].age<60){
printf("%s\n",peo[i].num);
}
}
return 0;
} | 9 |
4,279 | int main()
{ int n,i,j,k;
scanf("%d",&n);
struct p{
char num[100];
int age;
}pa[100],p[100],t;
for(i=0;i<n;i++)
{scanf("%s%d",&pa[i].num,&pa[i].age);}
i=n-1;
for(j=n-1;j>=0;j--)
{
if(pa[j].age<60)
{p[i]=pa[j];
i--;}
}
k=i+1;
for(j=n-1;j>=0;j--)
{
if(pa[j].age>=60)
{p[i]=pa[j];
i--;}
}
for(j=0;j<k;j++)
{for(i=0;i<k-j-1;i++)
{if(p[i].age<p[i+1].age)
{t=p[i];
p[i]=p[i+1];
p[i+1]=t;}
}
}
for(i=0;i<n;i++)
{printf("%s\n",&p[i].num);}
return 0;
}
| 9 |
4,280 | struct patient{
char id[10];
int age;
};
void bubble(struct patient p[],int m);
void main()
{
struct patient p[200];
int n,i,t=100;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",p[i].id,&p[i].age);
if(p[i].age>=60)
{
p[t]=p[i];
t++;
p[i].age=0;
}
}
bubble(p,t);
for(i=100;i<t;i++)
{
printf("%s\n",p[i].id);
}
for(i=0;i<n;i++)
{
if(p[i].age!=0)
printf("%s\n",p[i].id);
}
}
void bubble(struct patient p[],int m)
{
int i,j;
struct patient temp;
for(j=101;j<m;j++)
{
for(i=100;i<m+100-j;i++)
{
if(p[i].age<p[i+1].age)
{
temp=p[i];
p[i]=p[i+1];
p[i+1]=temp;
}
}
}
}
| 9 |
4,281 |
struct bing
{
char id[10];
int age;
};
void main()
{
struct bing peo[120],old[120],young[120],temp;
int i,j,n,num1=0,num2=0;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",peo[i].id,&peo[i].age);
for(i=0;i<n;i++)
{
if(peo[i].age>=60)
{
old[num1]=peo[i];
num1=num1+1;
}
else
{
young[num2]=peo[i];
num2=num2+1;
}
}
for(i=0;i<num1-1;i++)
for(j=0;j<num1-i-1;j++)
{
if(old[j].age<old[j+1].age)
{
temp=old[j];
old[j]=old[j+1];
old[j+1]=temp;
}
}
for(i=0;i<num1;i++)
printf("%s\n",old[i].id);
for(i=0;i<num2;i++)
printf("%s\n",young[i].id);
} | 9 |
4,282 | struct s
{
char a[100];
int b;
struct s *next;
};
void main()
{
struct s *p1,*p2,*p0,*head,*insert(struct s *head,struct s *stud),*h;
int i,j,k,m,n,t,x;
scanf("%d",&n);
head=0;
p1=(struct s *)malloc(sizeof(struct s));h=(struct s *)malloc(sizeof(struct s));
p2=head=p1;
p1->next=0;k=0;j=0;
scanf("%s %d",p1->a,&p1->b);x=0;
if(p1->b<60)
{
p2=h=p1;
x=1;
}
else
p2=h;
for(i=0;i<n-1;i++)
{
p0=(struct s *)malloc(sizeof(struct s));
scanf("%s %d",p0->a,&p0->b);
if(p0->b>=60)
{
head=insert(head,p0);
k++;
}
else
{
p2->next=p0;
p2=p0;
j++;
}
}
p1=head;
if(x==0)
i=-1;
else
i=0;
for(;i<k;i++)
{
printf("%s\n",p1->a);
p1=p1->next;
}
if(x==0)
{p2=h->next;
i=0;}
else
{p2=h;i=-1;}
for(;i<j;i++)
{
printf("%s\n",p2->a);
p2=p2->next;
}
}
struct s *insert(struct s *head,struct s *stud)
{
struct s *p0,*p1,*p2;
p1=head;
p0=stud;
if(head==0)
{
head=p0;p0->next=0;
}
else
{while((p0->b<=p1->b)&&(p1->next!=0))
{p2=p1;
p1=p1->next;}
if(p0->b>p1->b)
{if(head==p1)head=p0;
else p2->next=p0;
p0->next=p1;}
else
{p1->next=p0;p0->next=0;}
}
return(head);
}
| 9 |
4,283 | // ??(14-6) ????.cpp : Defines the entry point for the console application.
//
struct patient
{
char id[20];
int age;
int num;
};
int main()
{
int n;
scanf("%d",&n);
int i,j;
struct patient p[100];
for(i=1;i<=n;++i)
{
scanf("%s%d",&p[i].id,&p[i].age);
p[i].num=i;
}
for(i=1;i<=n-1;++i)
{
for(j=i+1;j<=n;++j)
{
if(p[j].age>p[i].age)
{
struct patient t;
t=p[i];
p[i]=p[j];
p[j]=t;
}
}
}
for(i=1;p[i].age>=60;++i)
{
for(j=i+1;p[j].age==p[i].age;++j)
{
if(p[i].num>p[j].num)
{
struct patient t;
t=p[i];
p[i]=p[j];
p[j]=t;
}
}
printf("%s\n",p[i].id);
}
for(j=i;j<=n;++j)
{
int k;
for(k=j+1;k<=n;++k)
{
if(p[j].num>p[k].num)
{
struct patient t;
t=p[j];
p[j]=p[k];
p[k]=t;
}
}
printf("%s\n",p[j].id);
}
return 0;
}
| 9 |
4,284 |
int main()
{
int n,i,j;
struct s
{char id[10];
int age;
};
struct s S[100],Si;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%d",S[i].id,&S[i].age);
}
for(i=0;i<n-1;i++){
for(j=0;j<n-i-1;j++){
if(S[j+1].age>=60){
if(S[j].age<S[j+1].age){
Si=S[j];
S[j]=S[j+1];
S[j+1]=Si;
}
}
}
}
for(i=0;i<n;i++){
printf("%s\n",S[i].id);
}
} | 9 |
4,285 | int main (){
int a[100],e[100],f[100];
char c[100][100],b[100][100],d[100][100],x[100];
int n,p=0,q=0,k,z,i;
scanf("%d",&n);
for (i=0;i<n;i++){
scanf("%s%d",c[i],&a[i]);
if(a[i]>=60){
p++;
e[i-q]=a[i];
strcpy(b[i-q],c[i]);
}
if(a[i]<60){
q++;
f[i-p]=a[i];
strcpy(d[i-p],c[i]);
}
}
for (k=1;k<=p;k++){
for (i=0;i<p-k;i++){
if(e[i]<e[i+1]){
z=e[i];
e[i]=e[i+1];
e[i+1]=z;
strcpy( x,b[i]);
strcpy( b[i],b[i+1]);
strcpy( b[i+1],x);
}
}
}
for(i=0;i<p;i++){
puts(b[i]);
}
for(i=0;i<q;i++){
puts(d[i]);
}
return 0;
}
| 9 |
4,286 | int main()
{
int n,i,j,temp;
char t[10];
scanf("%d",&n);
int y[n];
char id[n][10];
for (i=0;i<n;i++)
scanf("%s %d",id[i],&y[i]);
for (i=1;i<n;i++)
{
if (y[i]>=60)
{ for (j=i;j>0;j--)
if (y[j-1]<y[j])
{
temp=y[j];
y[j]=y[j-1];
y[j-1]=temp;
strcpy(t,id[j]);
strcpy(id[j],id[j-1]);
strcpy(id[j-1],t);
}
}
}
for (i=0;i<n;i++)
printf("%s\n",id[i]);
}
| 9 |
4,287 | int main()
{
char a[110],b[100][1000];
int n,i,y,l,j,p=0,q=0,c[1000],d[1000],e[1000],m,s,g[1000],v[1000];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s %d",a,&y);
l=strlen(a);
for(j=0;j<l;j++)
{b[i-1][j]=a[j];} //??ID
b[i-1][l]='\0';
c[i-1]=y;//????
}
for(i=0;i<n;i++)//????
{
if(c[i]>=60)
{
d[p]=c[i];
g[p]=i;
p++;
}
else if(c[i]<60)
{
e[q]=c[i];
v[q]=i;
q++;
}
}
for(j=0;j<=p-1;j++)
{
for(i=0;i<=p-1;i++)
{
if(d[i]>m)
{ m=d[i];
s=i;
}
else if(d[i]<=m);
}
printf("%s\n",b[g[s]]);
m=0;
d[s]=0;
}
for(i=0;i<=q-1;i++)
printf("%s\n",b[v[i]]);
} | 9 |
4,288 | main()
{
int n,i;
scanf("%d",&n);
char ID[n][10];
int age[n];
for(i=0;i<=n-1;i++)
{
scanf("%s %d",ID[i],&age[i]);
}
char ID2[n][10];
int b[n];
int j=0,t,k;
for(i=0;i<=n-1;i++)
{
if(age[i]>=60)
{
b[j]=age[i];
strcpy(ID2[j],ID[i]);
j++;
}
}
char c[10];
for(k=0;k<j-1;k++)
{
for(i=0;i<j-1-k;i++)
{
if(b[i]<b[i+1])
{
t=b[i];
b[i]=b[i+1];
b[i+1]=t;
strcpy(c,ID2[i]);
strcpy(ID2[i],ID2[i+1]);
strcpy(ID2[i+1],c);
}
}
}
for(i=0;i<=j-1;i++)
printf("%s\n",ID2[i]);
char ID3[n][10];
int m=0;
for(i=0;i<n;i++)
{
if(age[i]<60)
{
strcpy(ID3[m],ID[i]);
m++;
}
}
for(i=0;i<=m-1;i++)
printf("%s\n",ID3[i]);
}
| 9 |
4,289 |
int main()
{
int n,i,j,k;
int slotnum;
char slot[100];
scanf("%d",&n);
char s1[100][100];
int s2[100];
char a1[100][100];
int a2[100];
int anum=0;
char b1[100][100];
int b2[100];
int bnum=0;
for(i=0,j=0,k=0;i<n;i++)
{
scanf("%s %d",s1[i],&s2[i]);
if(s2[i]>=60)
{
strcpy(a1[j],s1[i]);
a2[j]=s2[i];
j++;
anum++;
}
if(s2[i]<60)
{
strcpy(b1[k],s1[i]);
b2[k]=s2[i];
k++;
bnum++;
}
}
for(i=anum-1;i>0;i--)
{
for(j=0;j<i;j++)
{
if(a2[j]<a2[j+1])
{
strcpy(slot,a1[j]);
strcpy(a1[j],a1[j+1]);
strcpy(a1[j+1],slot);
slotnum=a2[j];
a2[j]=a2[j+1];
a2[j+1]=slotnum;
}
}
}
for(i=0;i<anum;i++)
{
printf("%s\n",a1[i]);
}
for(i=0;i<bnum;i++)
{
printf("%s\n",b1[i]);
}
return 0;
} | 9 |
4,290 | int main()
{
int i,a,n,e,sz[100],sx[100]={0};
char st[100][11],sa[11],sd[100][11];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",&st[i]);
scanf("%d",&sz[i]);
}
for(i=0;i<n;i++)
{
if(sz[i]>=60)
{
sx[i]=sz[i];
strcpy(sd[i],st[i]);
}
}
for(i=1;i<=n;i++)
{
for(a=0;a<n-i;a++)
{
if(sx[a]<sx[a+1])
{
e=sx[a];
sx[a]=sx[a+1];
sx[a+1]=e;
strcpy(sa,sd[a]);
strcpy(sd[a],sd[a+1]);
strcpy(sd[a+1],sa);
}
}
}
for(i=0;i<n;i++)
{
if(sx[i]>=60)
puts(sd[i]);
}
for(i=0;i<n;i++)
{
if(sz[i]<60)
puts(st[i]);
}
return 0;
} | 9 |
4,291 |
struct pat
{
char id[30];
int age;
int num;
int flag;
struct pat *next;
struct pat *ns;
};
int n;
void sort(struct pat *head)
{
int i,j;
struct pat *q,*p,*max;
q=head;
for(i=0;i<n;i++)
{
p=head->next;
while(1)
{
if(p->flag)
break;
p=p->next;
}
max=p;
while(1)
{
if((p->num)>(max->num)&&p->flag)
max=p;
p=p->next;
if(p==NULL)
break;
}
max->flag=0;
q->ns=max;
q=q->ns;
}
q->ns=NULL;
}
void main()
{
int i;
struct pat *head,*p1,*p2,*p;
scanf("%d",&n);
head=(struct pat*)malloc(LEN);
for(i=0;i<n;i++)
{
p1=(struct pat*)malloc(LEN);
scanf("%s %d",p1->id,&p1->age);
p1->flag=1;
if(p1->age>=60)
p1->num=10000*p1->age+n-i;
else
p1->num=n-i;
if(i==0)
{
head->next=p1;
p2=p1;
}
else
p2->next=p1;
p2=p1;
}
p2->next=NULL;
sort(head);
p=head->ns;
for(i=0;i<n;i++)
{
printf("%s\n",p->id);
p=p->ns;
}
} | 9 |
4,292 | int main()
{
struct patient
{
char num[11];
int age;
}
pat[101],t;
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",&pat[i].num,&pat[i].age);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if((pat[j].age<60&&pat[j+1].age>=60)||(pat[j].age>=60&&pat[j+1].age>pat[j].age))
{
t=pat[j];
pat[j]=pat[j+1];
pat[j+1]=t;
}
}
}
for(i=0;i<n;i++)
{
printf("%s\n",pat[i].num);
}
return 0;
} | 9 |
4,293 | struct patient{
char ID[10];
int age;
};
void paixu(struct patient pat[],int n)
{
struct patient t;
int i;
int k;
for(k=1;k<n;k++){
for(i=0;i<n-k;i++){
if(pat[i].age<pat[i+1].age){
t=pat[i];
pat[i]=pat[i+1];
pat[i+1]=t;
}
}
}
}
int main()
{
struct patient pat;
struct patient oldpat[100];
struct patient youngpat[100];
int n;
int i;
int m=0;
int k=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d",pat.ID,&pat.age);
if(pat.age>=60){
oldpat[m]=pat;
m++;
}else{
youngpat[k]=pat;
k++;
}
}
paixu(oldpat,m);
for(i=0;i<m;i++){
printf("%s\n",oldpat[i].ID);
}
for(i=0;i<k;i++){
printf("%s\n",youngpat[i].ID);
}
return 0;
}
| 9 |
4,294 | struct huanzhe
{char id[11];
int age;
}sick[110];
int panduan(int *p1,int *p2,int a,int b);
void paixu(int *p3,int *p4,int c);
int main(int argc, char* argv[])
{
int n,i,pan;
int ji[110]={1};
int zhangzhe[110];
int *pointer1,*pointer2;
pointer1=ji;
pointer2=zhangzhe;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d",&sick[i].id,&sick[i].age);
}
for(i=0;i<n;i++){
pan=panduan(pointer1,pointer2,sick[i].age,i);
if(pan){sick[i].age=0;}
}
paixu(pointer1,pointer2,ji[0]);
for(i=1;i<ji[0];i++){
printf("%s\n",&sick[ji[i]].id);
}
for(i=0;i<n;i++){
if(sick[i].age==0){
continue;
}
printf("%s\n",sick[i].id);
}
return 0;
}
int panduan(int *p1,int *p2,int a,int b){
int jieguo=0;
if(a>=60){
*(p1+*p1)=b;
*(p2+*p1)=a;
(*p1)++;
jieguo=1;
}
return(jieguo);
}
void paixu(int *p3,int *p4,int c){
int j,k,temp;
for(j=0;j<c;j++){
for(k=1;k<c-1;k++){
if(*(p4+k)<*(p4+k+1)){
bian(p3);
bian(p4);
}
}
}
} | 9 |
4,295 |
struct p
{
char id[11];
int age;
};
int main()
{
void sort(int n,struct p a[101]);
int n,i;
struct p a[101];
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%s %d",&a[i].id,&a[i].age);
}
sort(n,a);
return 0;
}
void sort(int n,struct p a[101])
{
int i,k=0;
for(i=0;i<n;i++)
{
if((a[i].age)>k)
k=(a[i].age);
}
for(;k>59;k--)
{
for(i=0;i<n;i++)
{
if((a[i].age)==k)
{
printf("%s\n",a[i].id);
(a[i].age)=0;
}
}
}
for(i=0;i<n;i++)
{
if((a[i].age)!=0)
{
printf("%s\n",a[i].id);
}
}
} | 9 |
4,296 | int max(int a[],int n)
{ int i,s;
for(i=1,s=a[1];i<n;i++)
s=(s>=a[i])?s:a[i];
return (s);
}
main()
{ int a[200]={0},i,n,c[200]={0},e,t=1;
char b[200][12];
scanf("%d",&n);
for(i=1;i<=n;i++)
{ scanf("%s%d",b[i],&e);
if(e>=60)
a[i]=e;
else
c[i]=e;
}
for(;;)
{ t=max(a,n) ;
if (t==0)
break;
for(i=1;i<=n;i++)
{
if(a[i]==t)
{ printf("%s\n",b[i]);
a[i]=0;
}
}
}
for(i=1;i<=n;i++)
if(c[i]!=0)
printf("%s\n",b[i]);
}
| 9 |
4,297 | int main()
{
int n,i,j;
scanf("%d",&n);
struct point
{
char id[10];
int age;
}
points[100],news[100],tmp;
for(i=0;i<n;i++)
{
scanf("%s %d",&points[i].id,&points[i].age);
}
for(i=n-1;i>=0;i--)
{
for(j=0;j<i;j++)
{
if(points[j+1].age>=60&&points[j+1].age>points[j].age)
{
tmp=points[j+1];
points[j+1]=points[j];
points[j]=tmp;
}
}
}
for(i=0;i<n;i++)
{
printf("%s\n",points[i].id);
}
return 0;
} | 9 |
4,298 | struct bin
{
char ID[10];
int age;
struct bin *next;
};
void main()
{
struct bin *head,*p,*p1,*p2,*p3;
int m,n,i,j,k;
scanf("%d",&n);
p=(struct bin*)malloc(sizeof(struct bin));
scanf("%s%d",&p->ID,&p->age);
head=p3=p;
p->next=0;
for(i=1;i<n;i++)
{
p=(struct bin*)malloc(sizeof(struct bin));
scanf("%s%d",&p->ID,&p->age);
if(p->age<60)
{
p3->next=p;
p->next=0;
p3=p;
}
else
{
if(p->age>head->age)
{
p->next=head;
head=p;
}
else if(p->age<=p3->age)
{
p3->next=p;
p->next=0;
p3=p;
}
else
{
p1=head;
p2=p1->next;
while(p2->age>=p->age)
{
p1=p1->next;
p2=p2->next;
}
p1->next=p;
p->next=p2;
}
}
}
for(;head!=0;head=head->next)
{
printf("%s\n",head->ID);
}
} | 9 |
4,299 | void main()
{
int i,j=0,k=0,n,n1=-1,n2=-1,old=0;
char xiao[100][10];
struct bingren
{
char id[10];
int age;
};
struct bingren a[100];
struct bingren b[100];
struct bingren t;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s%d",a[i].id,&a[i].age);
for(i=0;i<n;i++)
{
if(a[i].age>=60)
{
b[j]=a[i];
n1++;
j++;
}
else
{
strcpy(xiao[k],a[i].id);
k++;
n2++;
}
}
for(i=0;i<n1;i++)
{
for(j=0;j<n1-i;j++)
{
if(b[j].age<b[j+1].age)
{
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
}
}
}
for(i=0;i<=n1;i++)
printf("%s\n",b[i].id);
for(i=0;i<=n2;i++)
printf("%s\n",xiao[i]);
}
| 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.