| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148115 | 李朋秦 | 奖学金 | C++ | Accepted | 1 MS | 276 KB | 661 | 2026-02-09 17:02:34 |
#include<bits/stdc++.h> using namespace std; struct student{ int c; int m; int e; int n; int t; }stu[301]; bool cmp(student x,student y){ if(x.t<y.t)return true; else if(x.t==y.t){ if(x.c<y.c)return true; else if(x.c==y.c){ return x.n>y.n; } } return false; } int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>stu[i].c>>stu[i].m>>stu[i].e; stu[i].n=i+1; stu[i].t=stu[i].c+stu[i].m+stu[i].e; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-1-i;j++){ if(cmp(stu[j],stu[j+1])){ swap(stu[j],stu[j+1]); } } }for(int i=0;i<5;i++){ cout<<stu[i].n<<" "<<stu[i].t<<endl; } return 0; }