- 谁拿了最多奖学金
- 2014-12-18 17:17:03 @
#include<cstdio>
int main()
{
int t,sum=0,maxx=0,n,ss[100]={0};
struct student{
char name[20];
int grade;
int pf;
char gb;
char xb;
int lw;
};
struct student stu[100];
scanf("%d\n",&n);
for(int i=0;i<=n;i++)
{
scanf("%s%d%d%c%c%d",stu[i].name,&stu[i].grade,&stu[i].pf,&stu[i].gb,&stu[i].xb,&stu[i].lw);
if(stu[i].grade>80&&stu[i].lw>0) ss[i]+=8000;
if(stu[i].grade>85&&stu[i].pf>80) ss[i]+=4000;
if(stu[i].grade>90) ss[i]+=2000;
if(stu[i].grade>85&&stu[i].xb=='Y') ss[i]+=1000;
if(stu[i].pf>80) ss[i]+=850;
sum+=ss[i];
}
for(int j=0;j<n;j++)
if(ss[j]>maxx) {maxx=ss[j];t=j;}
printf("%s\n%d\n%d\n",stu[t].name,ss[t],sum);
return 0;
}
###显示为RE 求大神纠错
2 条评论
-
Lucien LV 4 @ 2014-12-18 18:43:49
###又发错了。。。
include<cstdio>
int main()
{
int t,sum=0,maxx=0,n,ss[100]={0};
struct student{
char name[20];
int grade;
int pf;
char gb;
char xb;
int lw;
};
struct student stu[100];
scanf("%d\n",&n);
for(int i=0;i<n;i++)
{
scanf("%s%d%d%c%c%d",stu[i].name,&stu[i].grade,&stu[i].pf,&stu[i].gb,&stu[i].xb,&stu[i].lw);
if(stu[i].grade>80&&stu[i].lw>0) ss[i]+=8000;
if(stu[i].grade>85&&stu[i].pf>80) ss[i]+=4000;
if(stu[i].grade>90) ss[i]+=2000;
if(stu[i].grade>85&&stu[i].xb=='Y') ss[i]+=1000;
if(stu[i].pf>80) ss[i]+=850;
sum+=ss[i];
}
for(int j=0;j<n;j++) if(ss[j]>maxx) {maxx=ss[j];t=j;}
printf("%s\n%d\n%d\n",stu[t].name,ss[t],sum);
return 0;
} -
2014-12-18 18:43:05@
###我刚发现i多了1,但改了之后变WA了。。。继续求纠错
include<cstdio>
int main()
{
int t,sum=0,maxx=0,n,ss[100]={0};
struct student{
char name[20];
int grade;
int pf;
char gb;
char xb;
int lw;
};
struct student stu[100];
scanf("%d\n",&n);
for(int i=0;i<=n;i++)
{
scanf("%s%d%d%c%c%d",stu[i].name,&stu[i].grade,&stu[i].pf,&stu[i].gb,&stu[i].xb,&stu[i].lw);
if(stu[i].grade>80&&stu[i].lw>0) ss[i]+=8000;
if(stu[i].grade>85&&stu[i].pf>80) ss[i]+=4000;
if(stu[i].grade>90) ss[i]+=2000;
if(stu[i].grade>85&&stu[i].xb=='Y') ss[i]+=1000;
if(stu[i].pf>80) ss[i]+=850;
sum+=ss[i];
}
for(int j=0;j<n;j++) if(ss[j]>maxx) {maxx=ss[j];t=j;}
printf("%s\n%d\n%d\n",stu[t].name,ss[t],sum);
return 0;
}
- 1