6 条题解
-
0
using namespace std; struct cj{ int Chinese,Math,English; int xh; int total; }a[10000]; bool pm(cj x,cj y){ if(x.total==y.total){ if(x.Chinese==y.Chinese) return x.xh<y.xh; else return x.Chinese>y.Chinese; } else{ return x.total>y.total; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i].Chinese>>a[i].Math>>a[i].English; a[i].xh=i; a[i].total=a[i].Chinese+a[i].Math+a[i].English; } sort(a+1,a+n+1,pm); for(int i=1;i<=5;i++){ cout<<a[i].xh<<" "<<a[i].total; cout<<endl; } return 0; }
信息
- ID
- 303
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 239
- 已通过
- 111
- 上传者