lovely_Alicia @ 2022-10-26 21:51:03
#include<iostream>
#include<algorithm>
using namespace std;
struct A{
int Chinese,Math,English,bh,zf;
} a[305];
bool cmp(A x,A y)
{
if(x.zf==y.zf)
{
if(x.Chinese==y.Chinese)
{
return x.bh<y.bh;
}
else
{
return x.Chinese<y.Chinese;
}
}
else
{
return x.zf<y.zf;
}
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].Chinese>>a[i].Math>>a[i].English;
a[i].bh=i;
a[i].zf=a[i].Chinese+a[i].English+a[i].Math;
}
sort(a+1,a+n+1,cmp);
for(int i=n;i>=n-4;i--)
{
cout<<a[i].bh<<' '<<a[i].zf<<endl;
}
return 0;
}
by digby @ 2022-10-26 22:01:13
by lovely_Alicia @ 2022-10-27 21:34:11
@digby 谢谢