/*#include<stdio.h>
#include<string.h>
#include<stdlib.h>*/
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
struct node
{
char name[20];
char time[20];
int s;
} f[20];
int cmp(const void *a,const void *b)
{
node *c=(node *)a; node *d=(node *)b;
if(strcmp(c->time,d->time)>0)
return 1;
if(strcmp(c->time,d->time)<0)
return -1;
if(strcmp(c->time,d->time)==0)
return c->name >d->name?-1:1;
}
int main()
{
int n;
int i;
int flag=0;
int k;
int t=1;
int r;
while(scanf("%d",&n)&&n)
{
if(flag)
printf("\n");
for(i=0;i<n;i++)
scanf("%s%s",f[i].name,f[i].time);
qsort(f,n,sizeof(f[0]),cmp);
k=1;
r=1;
printf("Case #%d\n",t++);
printf("%s %d\n",f[0].name,r);
f[0].s=1;
k++;
for(i=1;i<n;i++)
{
printf("%s ",f[i].name);
if(strcmp(f[i].time,f[i-1].time)==0);
else
{
r=i+1;
}
k++;
printf("%d\n",r);
}
flag=1;
}
return 0;
}
hdu 2115 I Love This Game
最新推荐文章于 2016-05-15 00:13:18 发布