#include struct student { char name[21]; int cj[2]; //cj[0]表示期末成绩,cj[1]表示班级评议成绩 char ch[2]

#include
struct student
{
char name[21];
int cj[2]; //cj[0]表示期末成绩,cj[1]表示班级评议成绩
char ch[2]; //ch[0]是否是学生干部,ch[1]是否是西部省份学生
int num; //发表论文数
int jxj; //奖学金
}st[101];

int main(void)
{
//freopen("奖学金.in", "r", stdin);
int N;
int zong, max; //zong存放总奖学金,max存放最大奖学金
scanf("%d", &N);

while(N--)
{
int m;
zong=max=0;
scanf("%d", &m);
getchar();
int i = 1;
int j; //存放最大奖学金所在的下标
while(i<=m)
{
scanf("%s%d%d", st[i].name, &st[i].cj[0], &st[i].cj[1]);
getchar();
scanf("%c %c%d", &st[i].ch[0], &st[i].ch[1], &st[i].num);
getchar();
st[i].jxj = 0;
if(st[i].cj[0]>80 && st[i].num>=1)
st[i].jxj += 8000;
if(st[i].cj[0]>85 && st[i].cj[1]>80)
st[i].jxj += 4000;
if(st[i].cj[0]>90)
st[i].jxj += 2000;
if(st[i].cj[0]>85 && st[i].ch[1]=='Y')
st[i].jxj += 1000;
if(st[i].cj[1]>80 && st[i].ch[0]=='Y')
st[i].jxj += 850;
zong += st[i].jxj;
if(st[i].jxj>max)
{
j = i;
max = st[i].jxj;
}
i++;
}

printf("%s\n%d\n%d\n", st[j].name, st[j].jxj, zong);
}

return 0;
}

#include
struct student
{
char name[21];
int cj[2]; //cj[0]表示期末成绩,cj[1]表示班级评议成绩
char ch[2]; //ch[0]是否是学生干部,ch[1]是否是西部省份学生
int num; //发表论文数
int jxj; //奖学金
}st[101];

int main(void)
{
//freopen("奖学金.in", "r", stdin);
int N;
int zong, max; //zong存放总奖学金,max存放最大奖学金
scanf("%d", &N);

while(N--)
{
int m;
zong=max=0;
scanf("%d", &m);
getchar();
int i = 1;
int j; //存放最大奖学金所在的下标
while(i<=m)
{
scanf("%s%d%d", st[i].name, &st[i].cj[0], &st[i].cj[1]);
getchar();
scanf("%c %c%d", &st[i].ch[0], &st[i].ch[1], &st[i].num);
getchar();
st[i].jxj = 0;
if(st[i].cj[0]>80 && st[i].num>=1)
st[i].jxj += 8000;
if(st[i].cj[0]>85 && st[i].cj[1]>80)
st[i].jxj += 4000;
if(st[i].cj[0]>90)
st[i].jxj += 2000;
if(st[i].cj[0]>85 && st[i].ch[1]=='Y')
st[i].jxj += 1000;
if(st[i].cj[1]>80 && st[i].ch[0]=='Y')
st[i].jxj += 850;
zong += st[i].jxj;
if(st[i].jxj>max)
{
j = i;
max = st[i].jxj;
}
i++;
}

printf("%s\n%d\n%d\n", st[j].name, st[j].jxj, zong);
}

return 0;
}

你可能感兴趣的:(#include struct student { char name[21]; int cj[2]; //cj[0]表示期末成绩,cj[1]表示班级评议成绩 char ch[2])