yuan_qiu @ 2024-10-21 13:34:55
#include<bits/stdc++.h>
using namespace std;
int n,a[1001],b[1001],c[1001],maxx[1001],summ;
string name[1001];
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>name[i]>>a[i]>>b[i]>>c[i];
maxx[i]=a[i]+b[i]+c[i];
if(maxx[i]>maxx[summ]){
summ=i;
//cout<<"***"<<endl;
}
else{
summ=summ;
//cout<<"####"<<endl;
}
}
cout<<name[summ]<<" "<<a[summ]<<" "<<b[summ]<<" "<<c[summ];
}
by fulezhegerujile @ 2024-10-21 13:56:48
8-10行有问题
by fulezhegerujile @ 2024-10-21 13:57:46
@fulezhegerujile 看错了
by mnlbnkk @ 2024-10-21 17:01:52
@yuan_qiu 你都把我拉黑了我怎么@你\
还有,这个屎山代码怎么可能过\
我们来盘点你犯的七宗罪
#include<bits/stdc++.h>
using namespace std;
int n,a[1001],b[1001],c[1001],maxx[1001],summ;
string name[1001];
int main()
{
cin>>n;summ=1;
for(int i=1;i<=n;i++){
cin>>name[i]>>a[i]>>b[i]>>c[i];
maxx[i]=a[i]+b[i]+c[i];
if(maxx[i]>maxx[summ]){
summ=i;
//cout<<"***"<<endl;
}
else{
summ=summ;
//cout<<"####"<<endl;
}
}
cout<<name[summ]<<" "<<a[summ]<<" "<<b[summ]<<" "<<c[summ];
}
其他的懒得改了