#include<iostream> #include<stdio.h> #include<cmath> #include<algorithm> #include<string> using namespace std; struct stu { string name; int score; int cscore; char ganbu; char west; int lunwen; int sum; int num; }s[1001]; bool cmp(stu a, stu b) { if (a.sum == b.sum) return a.num < b.num; return a.sum > b.sum; } int main() { int n; cin >> n; int Sum = 0; for (int i = 0; i < n; i++) { cin >> s[i].name >> s[i].score >> s[i].cscore >> s[i].ganbu >> s[i].west >> s[i].lunwen; s[i].num = i + 1; if (s[i].score > 80 && s[i].lunwen >= 1) { s[i].sum += 8000; } if (s[i].score > 85 && s[i].cscore > 80) { s[i].sum += 4000; } if (s[i].score > 90) { s[i].sum += 2000; } if (s[i].score > 85 && s[i].west == 'Y') { s[i].sum += 1000; } if (s[i].cscore > 80 && s[i].ganbu == 'Y') { s[i].sum += 850; } Sum += s[i].sum; } sort(s, s + n, cmp); cout << s[0].name << endl << s[0].sum << endl << Sum << endl; return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:677 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:590 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:695 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:900 |
C语言训练-亲密数 (C语言代码)浏览:697 |
a+b浏览:452 |
蚂蚁感冒 (C语言代码)浏览:1408 |
A+B for Input-Output Practice (VII) (C语言代码)浏览:566 |
简单的a+b (C语言代码)浏览:529 |
大家好,我是验题君浏览:604 |