Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
405 关清声 奖学金 C++ Wrong Answer 0 MS 264 KB 808 2022-08-16 18:40:28

Tests(0/10):


Code:

#include<iostream> #include<algorithm> using namespace std; struct stu { int m; int c; int e; int n; }; int as(stu x,stu y) { int t1=x.m+x.c+x.e; int t2=y.m+y.c+y.e; return t2>t1; } int main() { int n; cin>>n; struct stu a[n]; for(int i=0;i<n;i++) { cin>>a[i].c>>a[i].m>>a[i].e; a[i].n=i+1; } sort(a,a+n,as); for(int i=0;i<n;i++) { for(int l=0;l<n;l++) { int t1=a[l].c+a[l].e+a[l].m; int t2=a[l+1].c+a[l+1].e+a[l+1].m; if(t1==t2) { if(a[l].c<a[l+1].c) { swap(a[l],a[l+1]); } else if(a[l].c==a[l+1].c) { if(a[l].n<a[l+1].n) { swap(a[l],a[l+1]); } } } } } for(int i=n-1;i>n-6;i--) { int t=a[i].m+a[i].c+a[i].e; cout<<a[i].n<<" "<<t<<endl; } return 0; }


Run Info:

------Input------
118 12 28 82 9 52 37 56 84 13 19 88 44 20 75 6 88 98 33 61 69 21 59 37 81 29 98 24 21 55 3 37 57 40 71 90 56 80 53 73 2 62 12 0 17 100 19 0 94 20 20 23 24 78 82 90 84 56 53 53 69 0 85 96 69 74 40 83 9 77 76 88 70 38 60 54 41 72 3 75 80 83 64 6 51 57 83 98 47 21 66 80 63 41 55 94 42 65 41 76 97 89 39 59 39 0 15 18 14 90 16 85 7 97 54 47 48 17 46 38 20 40 19 19 9 67 22 24 13 72 95 74 0 90 58 10 0 35 69 11 8 24 45 24 45 96 27 19 27 36 58 29 34 65 22 36 29 11 80 71 69 75 24 42 61 57 69 82 94 63 25 8
------Answer-----
56 245 27 238 29 238 24 234 73 231
------Your output-----
56 245 29 238 27 238 24 234 73 231