whx090128 @ 2023-08-16 15:25:49
#include<bits/stdc++.h>
using namespace std;
string na[1500];
double yu[1800],shu[1800],yin[1800],sum[1800];
int main()
{
int n,maxl=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>na[i];
cin>>yu[i]>>shu[i]>>yin[i];
sum[i]=yu[i]+shu[i]+yin[i];
if(maxl<sum[i]) maxl=sum[i];
}
for(int i=1;i<=3;i++)
{
if(maxl==sum[i])
{
cout<<na[i]<<" ";
cout<<yu[i]<<" "<<shu[i]<<" "<<yin[i];
return 0;
}
}
}
by liu_le_chen @ 2023-08-16 15:36:56
for(int i=1;i<=3;i++)
{
if(maxl==sum[i])
{
cout<<na[i]<<" ";
cout<<yu[i]<<" "<<shu[i]<<" "<<yin[i];
return 0;
}
}
为什么是小于等于3(不应该是n吗?)
by liu_le_chen @ 2023-08-16 15:40:30
改了以后就AC
by gotocspandbetter @ 2023-08-16 15:43:43
16行应该是
i<=n
by whx090128 @ 2023-08-16 16:04:54
@liulechen 呜呜呜,谢谢大佬,脑子抽抽啦