/ Vijos / 讨论 / 问答 /

求大佬帮看p1001

#include<stdio.h>
#include<string.h>
typedef struct student{
char name[20];
int average;
int classes;
char cadre;
char west;
int paper;
}STU;
int main()
{
STU student[20]={0};
int i=0,n=0,maxaward=0;
char mvp[20];
scanf("%d",&n);
while(n--)
{
scanf("%s %d %d %c %c %d",STU student[i]->name,&STU student[i]->average,&STU student[i]->classes,&STU student[i]->cadre,&STU student[i]->west,&STU student[i]->paper);
int award=0,j=0;
memset(STU[i]->name,0,20);
memset(mvp,0,20);
if (STU student[i]->average>80&&STU student[i]->paper>=1) award+=8000;
if (STU student[i]->average>85&&STU student[i]->classes>80) award+=4000;
if (STU student[i]->average>90) award+=2000;
if (STU student[i]->west='Y'&&STU student[i]->average>85)award+=1000;
if (STU student[i]->classes>80) award+=850;

if(j=0)
{
strcpy(mvp,STU[i]->name);
maxaward=award;
}
else{if(award>maxaward)
strcpy(mvp,STU->name);
}
}
printf("%s %d",mvp,maxaward);
return 0;
}

2 条评论

  • 1