hellowcworld @ 2022-12-03 15:37:58
#include<iostream>
using namespace std;
#include<cctype>
struct students{
char name[10];
int chi;
int math;
int eng;
};
void best(students player[],int n);
int main()
{
int n;
cin>>n;
students player[n];
for(int index=0;index<n;index++)
cin>>player[index].name>>player[index].chi>>player[index].math>>player[index].eng;
for(int index=0;index<n;index++)
best(player,n);
return 0;
}
void best(students player[],int n)
{
int max=0,i;
for(int index=0;index<n;index++)
{
if(player[index].chi+player[index].math+player[index].eng>max)
{max=player[index].chi+player[index].math+player[index].eng;i=index;}
}
cout<<player[i].name<<" "<<player[i].chi<<" "<<player[i].math<<" "<<player[i].eng;
}
by coder_Luogo @ 2022-12-03 15:52:05
看私信
by InversionShadow @ 2022-12-03 15:52:36
《90分第一个AC了》
by ud2_ @ 2022-12-03 16:18:29
没有考虑全为 0 分的情况。
如果确实提交了帖子中的这份代码,那么应该是一分都得不到的,所以去看了评测记录。
by hellowcworld @ 2022-12-05 21:53:06
@ud2_ 感谢感谢,把max改成负数就过了
by ningyuqi_xin @ 2023-03-12 21:52:00
第一个测试点有问题