RingTouSou @ 2023-09-24 19:09:00
#include<bits/stdc++.h>
using namespace std;
struct mystruct
{
string a;
int b,c,d;
int sum=0;
}q[1010];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q[i].a>>q[i].b>>q[i].c>>q[i].d;
q[i].sum=q[i].b+q[i].c+q[i].d;
}
int max=0;
int t;
for(int i=0;i<n;i++)
{
if(q[i].sum>max)
{
max = q[i].sum;
t=i;
}
}
cout<<q[t].a<<' '<<q[t].b<<' '<<q[t].c<<' '<<q[t].d;
return 0;
}
by wendywu @ 2023-09-24 19:15:36
把max初始化为-1试试
by wendywu @ 2023-09-24 19:25:47
毕竟题目没说总分不是零,所以有可能输出的时候t是无穷大
by wendywu @ 2023-09-24 19:28:15
我之前也被它坑过
by RingTouSou @ 2023-09-24 21:43:56
@wendywu 确实是的 AC 谢谢