#include stdio.h int main () { int t , i , term , clas , papers , sum , maxsum , allsum , x , mark ; char a [ 101 ][ 20 ], west , leader ; scanf ( "%d" , t ); while ( t -- ) { scanf ( "%d" , x ); maxsum = allsum = 0 ; for ( i = 0 ; i x ; i
int main()
{
int t,i,term,clas,papers,sum,maxsum,allsum,x,mark;
char a[101][20],west,leader;
scanf("%d",&t);
while(t--)
{
scanf("%d",&x);
maxsum=allsum=0;
for(i=0;i<x;i++)
{
scanf("%s %d %d %c %c %d",&a[i],&term,&clas,&leader,&west,&papers);
sum=0;
if(papers>=1&&term>80)
sum=sum+8000;
if(term>85&&clas>80)
sum=sum+4000;
if(term>90)
sum=sum+2000;
if(term>85&&west=='Y')
sum=sum+1000;
if(clas>80&&leader=='Y')
sum=sum+850;
allsum=allsum+sum;
if(sum>maxsum)
maxsum=sum,mark=i;
}
printf("%s\n%d\n%d\n",a[mark],maxsum,allsum);
}
return 0;
}