For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then receive a final grade no less than 60 out of 100. The final grade is calculated by G=(G​mid−term×40%+Gfinal×60%) if Gmid−term>G​final, or Gfinal will be taken as the final grade G. Here Gmid−term and Gfinal are the student's scores of the mid-term and the final exams, respectively.

The problem is that different exams have different grading sheets. Your job is to write a program to merge all the grading sheets into one.

Input Specification:

Each input file contains one test case. For each case, the first line gives three positive integers: P , the number of students having done the online programming assignments; M, the number of students on the mid-term list; and N, the number of students on the final exam list. All the numbers are no more than 10,000.

Then three blocks follow. The first block contains P online programming scores Gp 's; the second one contains M mid-term scores Gmid−term's; and the last one contains N final exam scores Gfinal 's. Each score occupies a line with the format: StudentID Score, where StudentID is a string of no more than 20 English letters and digits, and Score is a nonnegative integer (the maximum score of the online programming is 900, and that of the mid-term and final exams is 100).

***Output Specification:

For each case, print the list of students who are qualified for certificates. Each student occupies a line with the format:

StudentID G​p Gmid−term Gfinal G

If some score does not exist, output "−1" instead. The output must be sorted in descending order of their final grades (G must be rounded up to an integer). If there is a tie, output in ascending order of their StudentID's. It is guaranteed that the StudentID's are all distinct, and there is at least one qullified student.

Sample Input:

6 6 7

01234 880

a1903 199

ydjh2 200

wehu8 300

dx86w 220

missing 400

ydhfu77 99

wehu8 55

ydjh2 98

dx86w 88

a1903 86

01234 39

ydhfu77 88

a1903 66

01234 58

wehu8 84

ydjh2 82

missing 99

dx86w 81

Sample Output:

missing 400 -1 99 99

ydjh2 200 98 82 88

dx86w 220 88 81 84

wehu8 300 55 84 84

  1. #include<iostream> //海星
  2. #include<map>
  3. #include<algorithm>
  4. #include<vector>
  5. #include<math.h>
  6. using namespace std;
  7. struct node{
  8. string name;
  9. int Gp, Gm, Gf, G;
  10. };
  11. bool cmp(node n1, node n2){
  12. return (n1.G==n2.G?n1.name<n2.name:n1.G>n2.G);
  13. }
  14. int main(){
  15. map<string, int> index;
  16. vector<node> rank;
  17. string id;
  18. int p, m, n, cnt=1, s;
  19. cin>>p>>m>>n;
  20. for(int i=0; i<p; i++){
  21. cin>>id>>s;
  22. if(s>=200){
  23. rank.push_back(node{id, s, -1, -1});
  24. index[id]=cnt++;
  25. }
  26. }
  27. for(int i=0; i<m; i++){
  28. cin>>id>>s;
  29. if(index[id]!=0)
  30. rank[index[id]-1].Gm=s;
  31. }
  32. for(int i=0; i<n; i++){
  33. cin>>id>>s;
  34. if(index[id]!=0){
  35. rank[index[id]-1].Gf=s;
  36. if(s>=rank[index[id]-1].Gm)
  37. rank[index[id]-1].G=s;
  38. else
  39. rank[index[id]-1].G=round(0.4*rank[index[id]-1].Gm+0.6*s);
  40. }
  41. }
  42. sort(rank.begin(), rank.end(), cmp);
  43. for(int i=0; i<rank.size(); i++)
  44. if(rank[i].G>=60)
  45. cout<<rank[i].name<<" "<<rank[i].Gp<<" "<<rank[i].Gm<<" "<<rank[i].Gf<<" "<<rank[i].G<<endl;
  46. return 0;
  47. }

PAT 1137 Final Grading的更多相关文章

  1. PAT 1137 Final Grading[一般][排序]

    1137 Final Grading(25 分) For a student taking the online course "Data Structures" on China ...

  2. PAT 甲级 1137 Final Grading

    https://pintia.cn/problem-sets/994805342720868352/problems/994805345401028608 For a student taking t ...

  3. PAT A1137 Final Grading (25 分)——排序

    For a student taking the online course "Data Structures" on China University MOOC (http:// ...

  4. 1137 Final Grading (25 分)

    For a student taking the online course "Data Structures" on China University MOOC (http:// ...

  5. 1137 Final Grading

    题意:排序题. 思路:通过unordered_map来存储考生姓名与其成绩信息结构体的映射,成绩初始化为-1,在读入数据时更新各个成绩,最后计算最终成绩并把符合条件的学生存入vector,再排序即可. ...

  6. PAT_A1137#Final Grading

    Source: PAT A1137 Final Grading (25 分) Description: For a student taking the online course "Dat ...

  7. PAT甲级——A1137 Final Grading【25】

    For a student taking the online course "Data Structures" on China University MOOC (http:// ...

  8. A1137. Final Grading

    For a student taking the online course "Data Structures" on China University MOOC (http:// ...

  9. PAT (Advanced Level) 1136~1139:1136模拟 1137模拟 1138 前序中序求后序 1139模拟

    1136 A Delayed Palindrome(20 分) 题意:给定字符串A,判断A是否是回文串.若不是,则将A反转得到B,A和B相加得C,若C是回文串,则A被称为a delayed palin ...

随机推荐

  1. NOIP 2013 花匠 神仙操作

    题目:https://www.luogu.org/problemnew/show/P1970 今天又学习了一个新的神仙操作: 标签是DP,想了一下,没什么心情写,默默打开题解——(狂喜!) 一位大佬( ...

  2. Hadoop 分布式环境slave节点重启忽然不好使了

    Hadoop 分布式环境slaves节点重启: 忽然无法启动DataNode和NodeManager处理: 在master节点: vim /etc/hosts: 修改slave 节点的IP (这个时候 ...

  3. bzoj3252攻略(线段树+dfs序)

    3252: 攻略 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 562  Solved: 238[Submit][Status][Discuss] D ...

  4. RabbitMq安装成功后执行命令报错(Error: unable to connect to node 'rabbit@DESKTOP-LPKSION': nodedown)

    我们直接来看解决方案吧.首先打开服务,找到RabbitMq服务. 双击打开后选择登陆选项卡: 点选此账户,输入你计算机的登录名称.点击浏览: 在这里输入你的用户名,点检索: 这里的密码输入你电脑开机登 ...

  5. GG_Logs 日志类库封装使用说明

    3.6.GG_Logs 日志类库封装使用说明 GG_Logs类库项目,Nuget安装log4net 添加代码配置代码: [assembly: log4net.Config.XmlConfigurato ...

  6. Linux上安装禅道

    linux一键安装包内置了apache, php, mysql这些应用程序,只需要下载解压缩即可运行禅道. 从7.3版本开始,linux一键安装包分为32位和64位两个包,请大家根据操作系统的情况下载 ...

  7. E1963A/E6703B W-CDMA Online User's Guide

    官网资料地址: http://rfmw.em.keysight.com/rfcomms/refdocs/wcdma/

  8. SQLiteDeveloper 工具

    破解方法: cmd下执行命令:  reg delete HKEY_CURRENT_USER\SharpPlus\SqliteDev /f

  9. .Net实战之反射操作篇

    1.上一讲中描述了反射中常见的类,仅仅是描述类与反射之间的关系.   但是实际是对数据的操作,  在反射中,数据如何操作? [MyTable("T_UserInfo")] publ ...

  10. ASP MVC

    V-view 显示层 C-controller 控制层 M-model 模型 D-database 数据库 S-Service 服务 D-Database/Dao 数据库/访问数据库的方法 View即 ...