Serendi_Pity @ 2022-10-30 14:01:46
#include<bits/stdc++.h>
using namespace std;
string a[1001];
int b[1001],c[1001],d[1001],e[1001],s,f,n,ans=1;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i]>>c[i]>>d[i];
e[i]==b[i]+c[i]+d[i];
}
for(int j=1;j<=n;j++){
f=e[j];
s=e[j+1];
if(s>f){
ans=j+1;
}
}
cout<<a[ans]<<" "<<b[ans]<<" "<<c[ans]<<" "<<d[ans];
}
by SquarFish @ 2022-11-01 22:08:07
for(int j=1;j<=n;j++){
f=e[j];
s=e[j+1];
if(s>f){
ans=j+1;
}
}
建议改为
for(int j=1;j<=n;j++){
if(e[j] > e[ans]) ans = j
}
还有
e[i]==b[i]+c[i]+d[i];
//e[i]=b[i]+c[i]+d[i];
by SquarFish @ 2022-11-01 22:09:10
这里
by Serendi_Pity @ 2022-11-03 20:18:37
@1105FPY 谢谢AC啦