Christophe_ @ 2020-07-17 14:51:37
#include<cstdio>
#include<algorithm>
using namespace std;
int n,Total[100000],Chinese[100000],Number[100000];
int main(void){
scanf("%d",&n);
for(int i=2;i<=n;i++){
int M,E;
scanf("%d %d %d",&Chinese[i-1],&M,&E);
Total[i-1]=Chinese[i-1]+M+E;
Number[i-1]=i-1;
}
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
if(Total[j]>Total[i]||Total[j]==Total[i]&&Chinese[j]>Chinese[i]||Total[j]==Total[i]&&Chinese[j]==Chinese[i]&&Number[j]<Number[i]){
swap(Total[j],Total[i]);
swap(Chinese[j],Chinese[i]);
swap(Number[j],Number[i]);
}
}
}
for(int i=1;i<=5;i++){
printf("%d %d\n",Number[i],Total[i]);
}
return 0;
}
by 修罗海神王 @ 2020-07-17 15:15:35
为什么不读
by Christophe_ @ 2020-07-17 15:32:57
@修罗海神王 谢谢您的指点!