#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
struct info
{
char no[10];
char name[25];
int yuwen;
int shuxue;
int yingyu;
int wuli;
int huaxue;
int zongfen;
};
char b[1002];
info a[50000];
int cmp(info a,info b)
{
if(a.zongfen!=b.zongfen)
{
return a.zongfen>b.zongfen;
}
if(a.zongfen==b.zongfen&&a.yuwen!=b.yuwen)
{
return a.yuwen>b.yuwen;
}
if(a.zongfen==b.zongfen&&a.yuwen==b.yuwen&&a.shuxue!=b.shuxue)
{
return a.shuxue>b.shuxue;
}
return strcmp(a.no,b.no)==-1;
};
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n,m;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%s",a[i].no);
scanf("%s%d%d%d%d%d",a[i].name,&a[i].yuwen,&a[i].shuxue,&a[i].yingyu,&a[i].wuli,&a[i].huaxue);
a[i].zongfen=a[i].yuwen+a[i].shuxue+a[i].yingyu+a[i].wuli+a[i].huaxue;
}
sort(a+1,a+1+n,cmp);
for(int i=1;i<=n;i++)
{
printf("%d ",i);
printf("%s ",a[i].no);
printf("%s %d %d %d %d %d %d\n",a[i].name,a[i].yuwen,a[i].shuxue,a[i].yingyu,a[i].wuli,a[i].huaxue,a[i].zongfen);
}
printf("\n");
int ans=0;
scanf("%d",&m);
for(int k=1;k<=m;k++)
{
scanf("%s",b);
ans=0;
for(int i=1;i<=n;i++)
{
if(strcmp(a[i].no,b)==0)
{
printf("%d ",i);
printf("%s ",a[i].no);
printf("%s %d %d %d %d %d %d\n",a[i].name,a[i].yuwen,a[i].shuxue,a[i].yingyu,a[i].wuli,a[i].huaxue,a[i].zongfen);
ans++;
break;
}
}
if(ans==0)
{
printf("Can't found!\n");
}
}
return 0;
}
查找太恶心