chy2002 @ 2022-06-03 17:21:30
90分,第三个测试点出问题了 求大佬解惑
by sto_OwenLMZ2022_orz @ 2022-06-03 17:42:06
@chy2002 可以参考一下
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
struct stu1{
char name[50]={0};
int c=0;
int m=0;
int y=0;
};
bool jug1(int a1,int b1,int c1,int a2,int b2,int c2){
bool y;
if((a1+b1+c1)>(a2+b2+c2)){
y=true;
return y;
}
else{
y=false;
return y;
}
}
int main(){
int n;
cin>>n;
stu1 a[n],d;
for(int i=0;i<n;i++){
cin>>a[i].name>>a[i].c>>a[i].m>>a[i].y;
}
strcpy(d.name,a[0].name);
d.c=a[0].c;
d.m=a[0].m;
d.y=a[0].y;
for(int i=0;i<n;i++){
if(jug1(a[i].c,a[i].m,a[i].y,d.c,d.m,d.y)){
strcpy(d.name,a[i].name);
d.c=a[i].c;
d.m=a[i].m;
d.y=a[i].y;
}
}
cout<<d.name<<" "<<d.c<<" "<<d.m<<" "<<d.y;
return 0;
}
by chy2002 @ 2022-06-05 17:36:24
@OwenLMZ2022 谢谢了,我知道是哪里的问题了