siyeansh @ 2021-08-31 18:27:44
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,ch[400],ma[400],en[400],score[400],num[400];
cin>>n;
for(int i=1;i<=n;i++){
cin>>ch[i]>>ma[i]>>en[i];
score[i]=ch[i]+ma[i]+en[i];
num[i]=i;
}
for(int i=1;i<n;i++){
for(int j=i+1;j<=n;j++){
if(score[i]<score[j]){
int t=score[i];
score[i]=score[j];
score[j]=t;
int r=num[i];
num[i]=num[j];
num[j]=r;
}
else if(score[i]==score[j]&&ch[i]<ch[j]){
int t=score[i];
score[i]=score[j];
score[j]=t;
int r=num[i];
num[i]=num[j];
num[j]=r;
}
else if(score[i]==score[j]&&ch[i]==ch[j]&&num[i]>num[j]){
int t=score[i];
score[i]=score[j];
score[j]=t;
int r=num[i];
num[i]=num[j];
num[j]=r;
}
}
}
for(int i=1;i<=5;i++){
cout<<num[i]<<' '<<score[i]<<endl;
}
return 0;
}
by chenxiaokang135 @ 2021-08-31 18:28:34
你没救了
by lonely_cyx @ 2021-08-31 18:29:58
@chenxiaokang135 lz没救了++
by siyeansh @ 2021-08-31 18:30:54
@chenxiaokang135 回:you too
by 已注销yj!gBUM @ 2021-08-31 18:31:11
@在下慕星尘 你这个代码写的是什么玩意
by siyeansh @ 2021-08-31 18:32:37
@jiayouba233 回:70分的玩意
by lonely_cyx @ 2021-08-31 18:33:22
@在下慕星尘 呀呀呀,本来就是没救了,还诬赖
by Sliarae @ 2021-08-31 18:36:14
btd?
by siyeansh @ 2021-08-31 18:38:42
@十里 回:非也非也
by thatsgame @ 2021-08-31 18:42:09
建议用排序和结构体优化一下
by siyeansh @ 2021-08-31 18:45:09
@修罗不及挽樱 回:我若会,何以问?