yanghe__20050825 @ 2018-11-01 18:49:32
using namespace std; struct node { int t; int num; int bb; int cc; int dd; }e[301]; inline bool cmp(const node &x,const node &y) { return x.t<y.t; } int main() { //freopen("scholar.in","r",stdin); //freopen("scholar.out","w",stdout); int a; scanf("%d",&a); for(int i=1;i<=a;i++) { scanf("%d%d%d",&e[i].bb,&e[i].cc,&e[i].dd); e[i].num=i; e[i].t=e[i].bb+e[i].cc+e[i].dd; } sort(e+1,e+a+1,cmp); for(int i=1;i<=a;i++) { if(e[i].t==e[i+1].t) { if(e[i].bb<e[i+1].bb) { swap(e[i].num,e[i+1].num); continue; } if(e[i].num<e[i+1].num) { swap(e[i].num,e[i+1].num); } } } for(int i=a;i>=a-4;i--) { cout<<e[i].num<<" "<<e[i].t<<endl; } return 0; }
by WA鸭鸭 @ 2018-11-01 18:50:02
希望更丰富的机惨展现?使用Markdown
by wxy_god @ 2018-11-01 18:52:38
希望更丰富的机惨展现?使用Markdown
by skiy_gyx @ 2018-11-01 18:52:56
希望更丰富的展现?使用Markdown
by skiy_gyx @ 2018-11-01 18:56:21
@yanghe__20050825 帮你整理好了
#include<bits/stdc++.h>
using namespace std;
struct node {
int t;
int num;
int bb;
int cc;
int dd;
}e[301];
inline bool cmp(const node &x,const node &y) {
return x.t<y.t;
}
int main() {
//freopen("scholar.in","r",stdin);
//freopen("scholar.out","w",stdout);
int a; scanf("%d",&a);
for(int i=1;i<=a;i++) {
scanf("%d%d%d",&e[i].bb,&e[i].cc,&e[i].dd);
e[i].num=i; e[i].t=e[i].bb+e[i].cc+e[i].dd;
}
sort(e+1,e+a+1,cmp);
for(int i=1;i<=a;i++) {
if(e[i].t==e[i+1].t) {
if(e[i].bb<e[i+1].bb) {
swap(e[i].num,e[i+1].num);
continue;
}
if(e[i].num<e[i+1].num) {
swap(e[i].num,e[i+1].num);
}
}
}
for(int i=a;i>=a-4;i--) {
cout<<e[i].num<<" "<<e[i].t<<endl;
}
return 0;
}
by 33028120040712wcl @ 2018-11-01 18:57:24
希望更丰富的展现?使用Markdown
by yanghe__20050825 @ 2018-11-01 19:04:48
@gyxAC之神
谢谢
by Ruirui_170219 @ 2018-11-09 11:30:29
@yanghe__20050825 您好。
scholar.in //输入
28
73 69 86
77 85 76
89 80 73
87 83 97
65 61 61
77 89 84
89 71 93
77 81 63
71 73 65
71 61 95
86 75 69
89 80 71
79 71 69
96 61 77
71 97 75
75 82 96
71 61 87
81 73 75
99 61 77
67 76 65
75 91 88
65 96 91
98 61 92
89 61 61
71 81 61
79 67 73
99 61 79
100 98 69
scholar.out //您的输出
4 267
28 267
21 254
16 253
7 253
scholar.ans //标准输出
28 267
4 267
21 254
7 253
16 253
有可能您没有处理语文成绩的先后qwq