1001 ( HDU 5427 ) A problem of sorting
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
问题描述
给出一张许多人的年龄和生日表。你需要从年轻到年老输出人们的名字。(没有人年龄相同)
输入描述
第一行包含一个正整数T(T≤5),表示数据组数。 对于每组数据,第一行包含一个正整数n(1≤n≤100),表示人数,接下来n行,每行包含一个姓名和生日年份(1900-2015),用一个空格隔开。姓名长度大于0且不大于100。注意姓名中只包含字母,数字和空格。
输出描述
对于每组数据,输出n行姓名。
输入样例
2 1 FancyCoder 1996 2 FancyCoder 1996 xyz111 1997
输出样例
FancyCoder xyz111 FancyCoder
注意:姓名中只包含字母,数字和空格。
/*
Problem : HDU5427 ( A problem of sorting )
Exe.Time 0MS Code Len. 1008 B
Exe.Memory 1600K Language G++
*/
#include
#include
#include
using namespace std;
int main()
{
int a[200];
char b[200];
int n,t,k,i,j,len;
char bb[200][200];
scanf("%d",&t);
while(t--)
{
memset(a,0,sizeof(a));
scanf("%d",&n);
getchar();
j=0;
for(i=0;i
=0;i--)
{
if(a[i])
{
for(j=0;bb[i][j]!='\0';j++)
{
printf("%c",bb[i][j]);
}
printf("\n");
}
}
}
return 0;
}