注意对是否是学生干部、和是否是西部学生的输入,如果用%c的话记得加上空格,scanf("%c %c",&stuent, &wes);
已AC代码:
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int n;
scanf("%d", &n);
char name[35], exam[35];
int avg0, avg1, l, temp=0, tend, sum=0;
char stu[4], wes[4];
for(int i=0; i<n; i++)
{
tend=0;
scanf("%s%d%d", name, &avg0, &avg1);
scanf("%s%s%d", stu, wes, &l);
if(avg0>80 && l>=1)
tend += 8000;
if(avg0>85 && avg1>80)
tend += 4000;
if(avg0>90)
tend += 2000;
if(avg0>85 && wes[0]=='Y')
tend += 1000;
if(avg1>80 && stu[0]=='Y')
tend += 850;
sum += tend;
if(tend > temp)
{
strcpy(exam, name);
temp = tend;
}
}
printf("%s\n%d\n%d\n", exam, temp, sum);
}
return 0;
}