NYoj 60 谁获得了最高奖学金
2014-04-24 21:10
411 查看
题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=60
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 110; struct studentNode { char name[21]; int average; int evalute; bool IsWest; bool IsLeader; int iPublishedNum; int scholarship; studentNode() { memset(name, 0, sizeof(name)); average = evalute = iPublishedNum = scholarship = 0; IsWest = IsLeader = false; } }iStudent[MAXN]; int main() { int T, n, iMax, iPos, i, all; scanf("%d", &T); char c1, c2; while(T--) { scanf("%d", &n); memset(iStudent, 0, sizeof(iStudent)); for(i = 0; i < n; ++i) { scanf("%s %d %d %c %c %d", iStudent[i].name, &iStudent[i].average, &iStudent[i].evalute, &c1, &c2, &iStudent[i].iPublishedNum); if(c2 == 'Y') iStudent[i].IsWest = true; else iStudent[i].IsWest = false; if(c1 == 'Y') iStudent[i].IsLeader = true; else iStudent[i].IsLeader = false; } iMax = 0, iPos = 0, all = 0; for(i = 0; i < n; ++i) { if(iStudent[i].average > 80 && iStudent[i].iPublishedNum >= 1) iStudent[i].scholarship += 8000, all += 8000; if(iStudent[i].average > 85 && iStudent[i].evalute > 80) iStudent[i].scholarship += 4000, all += 4000; if(iStudent[i].average > 90) iStudent[i].scholarship += 2000, all += 2000; if(iStudent[i].average > 85 && iStudent[i].IsWest) iStudent[i].scholarship += 1000, all += 1000; if(iStudent[i].evalute > 80 && iStudent[i].IsLeader) iStudent[i].scholarship += 850, all += 850; if(iMax < iStudent[i].scholarship) { iMax = iStudent[i].scholarship; iPos = i; } } printf("%s\n%d\n%d\n", iStudent[iPos].name, iStudent[iPos].scholarship, all); } return 0; }
相关文章推荐
- NYOJ 60 谁获得了最高奖学金
- nyoj 60 谁获得了最高奖学金
- NYOJ 60 谁获得了最高奖学金
- nyoj 60 谁获得了最高奖学金
- NYOJ-60 谁获得了最高奖学金
- NYOJ 60 谁获得了最高奖学金
- NYOJ-60-谁获得了最高奖学金-2013年10月12日14:55:45
- NYOJ 60 谁获得了最高奖学金
- NYOJ 60 谁获得了最高奖学金
- nyoj.60 谁获得了最高奖学金 20141016
- NYoj60谁获得了最高奖学金(结构体)
- NYOJ 60 谁获得了最高奖学金
- NYOJ_60 谁获得了最高奖学金
- NYOJ--60谁获得了最高奖学金
- NYOJ_60谁获得了最高奖学金
- NYOJ60谁获得了最高奖学金
- nyoj_60_谁获得了最高奖学金_201311281117
- NYOJ 60 谁获得了最高奖学金
- NYOJ--60-题目-------------------------------谁获得了最高奖学金
- NYOJ 60 谁获得了最高奖学金