4041nofoundGeoge @ 2024-04-06 22:14:44
#include <bits/stdc++.h>
using namespace std;
struct Stu
{
int id,c,m,e;
int sum=0;
void read()
{
cin>>c>>m>>e;
sum=c+m+e;
}
} s[305];
bool cmp(Stu x,Stu y)
{
if(x.sum>y.sum)return 1;
else if(x.sum<y.sum)return 0;
else
{
if(x.c>y.c)return 1;
else if(x.c==y.c)return 0;
else
{
if(x.id>y.id)return 1;
else return 0;
}
}
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
s[i].id=i;
s[i].read();
}
sort(s,s+n+1,cmp);
for(int i=1;i<=5;i++)
{
cout<<s[i].id<<" "<<s[i].sum<<endl;
}
return 0;
}
by Bob13678488602 @ 2024-04-16 21:48:44
chau时了吧!
by 4041nofoundGeoge @ 2024-04-18 20:42:02
改怎么改?
by szx6688 @ 2024-04-21 10:57:53
@4041nofoundGeoge 你是我最佩服的人
by 4041nofoundGeoge @ 2024-04-21 17:01:38
?(~△~?)