编程每日刷题系列二(PAT Ranking)
PAT Ranking
题目描述
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now it is your job to write a program to correctly merge all the ranklists and generate the final rank.
编程能力测试(PAT)是由浙江大学计算机科学与技术学院组织的。每个测试应该同时在几个地方运行,并且在测试之后,排名列表将立即合并。现在,你的工作是编写一个程序来正确地合并所有的排名,并生成最终的排名。
Input Specification:
Each input file contains one test case. For each case, the first line contains a positive number N (≤100), the number of test locations. Then N ranklists follow, each starts with a line containing a positive integer K (≤300), the number of testees, and then K lines containing the registration number (a 13-digit number) and the total score of each testee. All the numbers in a line are separated by a space.
每个输入文件包含一个测试用例。对于每种情况,第一行包含一个正数N(100),即考试位置的数量。然后是N份排名列表,每一份列表都以正整数K(300)、考生人数一行开头,然后是准考证号(13位数字)和考生考试总分在K行开头。一行中的所有数字用空格隔开。
Output Specification:
For each test case, first print in one line the total number of testees. Then print the final ranklist in the following format:
registration_number final_rank location_number local_rank
The locations are numbered from 1 to N. The output must be sorted in nondecreasing order of the final ranks. The testees with the same score must have the same rank, and the output must be sorted in nondecreasing order of their registration numbers.
对于每个测试用例,首先在一行中打印测试者的总数。然后以如下格式打印最终排名:
准考证号 最终排名 考场号 考场内排名
位置编号从1到n,输出必须按最终排名的非降序排序。相同分数的考生必须有相同的排名,并且输出必须按他们的准考证号的非降序排序。
Sample Input:
Sample Output:
参考代码如下(但是先动脑筋思考如何做)



C++代码:
样例运行结果如下:

之后我会持续更新,如果喜欢我的文章,请记得一键三连哦,点赞关注收藏,你的每一个赞每一份关注每一次收藏都将是我前进路上的无限动力 !!!↖(▔▽▔)↗感谢支持!