Straderetta @ 2022-02-26 15:34:03
#include<cstdio>
#include<algorithm>
struct student{
char a[101];
int c,m,e;
}s1,s2;
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%s %d %d %d",s1.a,&s1.c,&s1.m,&s1.e);
if(s1.c+s1.m+s1.e>s2.c+s2.m+s2.e) s2=s1;
}
printf("%s %d %d %d",s2.a,s2.c,s2.m,s2.e);
return 0;
}
by zps1122 @ 2022-04-08 21:16:54
来了,bro,我来help你了
by zps1122 @ 2022-04-08 21:24:48
你需要给s2赋值为-1 如果你在主函数以外定义的话,它的值会默认为0,而如果所有人的总分都是零,运算到计算机爆炸,他都不会执行你写的如下代码
if(s1.c+s1.m+s1.e>s2.c+s2.m+s2.e) s2=s1;
改完后,你就会AC~(≧▽≦)/~啦啦啦
by zps1122 @ 2022-04-08 21:25:20
@Straderetta
by Straderetta @ 2022-04-09 07:59:34
@zps1122 谢谢