tyvj p1002- 谁拿了最多奖学金[模拟]
2014-08-16 22:44
288 查看
#include <iostream> #include <cstdlib> #include <stdio.h> #include <algorithm> using namespace std; struct stu { string name; int no; int score, score_2, paper, money = 0; char leader, western; }student[105]; bool cmp(const stu &s1, const stu &s2) { if(s1.money == s2.money) return s1.no < s2.no; else return s1.money > s2.money; } int main() { int n; scanf("%d", &n); long long sum = 0; for(int i = 1; i <= n; ++i) { cin >> student[i].name >> student[i].score >> student[i].score_2 >> student[i].leader >> student[i].western >> student[i].paper; student[i].no = i; if(student[i].paper >= 1 && student[i].score > 80) student[i].money += 8000; if(student[i].score > 85 && student[i].score_2 > 80) student[i].money += 4000; if(student[i].score > 90) student[i].money += 2000; if(student[i].score > 85 && student[i].western == 'Y') student[i].money += 1000; if(student[i].score_2 > 80 && student[i].leader == 'Y') student[i].money += 850; } for(int i = 1; i <= n; ++i) sum += student[i].money; sort(student+1, student+1+n, cmp); /*int maxn = 0, number; for(int i = 1; i <= n; ++i) { if(student[i].money > maxn) { maxn = student[i].money; number = i; } } */ cout << student[1].name << endl; cout << student[1].money << endl; cout << sum << endl; return 0; }
相关文章推荐
- 【模拟】谁拿了最多奖学金
- 【模拟】谁拿了最多奖学金
- Vijos P1001 谁拿了最多的奖学金(模拟)
- tyvj P1002:谁拿了最多奖学金
- tyvj P1002 谁拿了最多奖学金
- noip2005 谁拿了最多奖学金 (模拟)
- 【模拟】谁拿了最多奖学金
- noip2005谁拿最多奖学金(模拟)题解
- [NOIP 2005]谁拿了最多奖学金 模拟
- 【排序+模拟】谁拿了最多奖学金 luogu-1051
- Sicily 1147. 谁拿了最多奖学金
- HUNAN UNIVERSITY ACM/ICPC Judge Online_Problem 10026_谁拿了最多奖学金
- 练习系统 实验一 谁拿了最多的奖学金
- P1002 谁拿了最多奖学金
- 04:谁拿了最多奖学金
- 模拟三次密码输入的场景。 最多能输入三次密码,密码正确,提示“登录成功”,密码错误,可以重新输入,最多输入三次。三次均错,则提示退出程序。
- 谁拿了最多奖学金
- Vijos P1001 谁拿了最多奖学金【分段计算处理】(Bailian2715)
- [NOIp2005] 谁拿了最多奖学金
- 1002:谁拿了最多奖学金