1 条题解
-
0
#include<iostream> #include<cstdio> #include<bits/stdc++.h> using namespace std; struct n { string a;//姓名a int b,c,zf;//语文b,数学c }p[100]; int main() { int rs;//人数rs cin>>rs;//输入人数 for(int g=0;g<rs;g++)//循环赋值 { cin>>p[g].a>>p[g].b>>p[g].c; p[g].zf=p[g].b+p[g].c; } for(int h=0;h<=rs;h++) { for(int l=0;l<rs-1;l++) { if(p[l].zf<p[l+1].zf) { swap(p[l],p[l+1]); } } } for(int g=0;g<rs;g++)//循环赋值 { cout<<p[g].a<<" "<<p[g].b<<" "<<p[g].c<<" "<<p[g].zf<<endl; } return 0; }
信息
- ID
- 502
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 60
- 已通过
- 19
- 上传者