翻滚侠 @ 2017-02-22 17:28:15
#include <algorithm>
#include <cstdio>
using namespace std;
bool cmp2(int x,int y){
return x>y;
}
struct chengji{
int yingyu;
int yuwen;
int shuxue;
};
chengji a[3000];
int x[3000];
int id[3000];
bool cmp1(int m,int y){
return x[m]>x[y];
}
int main(){
int n;
scanf("%d",&n);
int i;
for(i=1;i<=n;i++){
scanf("%d",&a[i].yuwen);
scanf("%d",&a[i].shuxue);
scanf("%d",&a[i].yingyu);
}
for(i=1;i<=n;i++){
x[i]=a[i].yuwen+a[i].shuxue+a[i].yingyu;
id[i]=i;
}
sort(id+1,id+(n+1),cmp1);
sort(x+1,x+(n+1),cmp2);
int t1,t2;
for(i=1;i<=n;i++){
if(x[i]==x[i+1] && a[id[i+1]].yuwen>a[id[i]].yuwen){
t1=x[i];
x[i]=x[i+1];
x[i+1]=t1;
t2=id[i];
id[i]=id[i+1];
id[i+1]=t2;
}
}
for(i=1;i<=5;i++)
printf("%d %d\n",id[i],x[i]);
return 0;
}
by zzy643930874 @ 2017-02-22 17:28:43
因为你丑~~~
by 翻滚侠 @ 2017-02-22 17:29:00
@zzy643930874 您素质真差
by zzy643930874 @ 2017-02-22 17:30:28
@翻滚侠 你装得跟不认识我一样,,,
by tarjen @ 2017-02-22 19:36:53
。。。。。。。。。。
by MOCOE @ 2017-08-02 18:33:30
你的sort函数出了问题