编程介的小学生 2017-10-11 11:18 采纳率: 0.2%
浏览 1476
已采纳

Selecting the Optimal Teaching Fiends

Description

In order to improve teaching quality, one school decides to select ten optimal teaching fiends from n (n<=50) teachers by means of secret ballot among the students.
According to the order of 1,2,3?the teachers are numbered continuously. Each No. has two characters, for example, 01,02,03,?
Every vote consists of the No. of the ten selected teachers. The position of the No represents place in the selection. The corresponding place in the selection can be vacant, but it must be expressed as 00. The vote in which the No. is outside the range stipulated, or appears repeatedly will be deserted. Score the teachers listed according to the order of teaching Fiends in the votes according to the following standards.

Order First Second Third Forth Fifth Sixth Seventh Eighth Ninth Tenth

Score 15 12 9 7 6 5 4 3 2 1

Sort the teachers from high to low according of the score each teacher gains. If the score is the same, the one who gains more votes is ahead; if the score and the number of votes are the same, the one who's No. is smaller is ahead.
Input

The information of the teachers and votes is stored in the file fiend.in according to the following format:
1) The first line of the file consists of the number of teachers (n) and the number of students (m), separated by a blank;
2) The lines from the second to n+1 contain the information of n teachers; each line contains the information of a teacher. The information of teachers makes up No., name, department, which are separated by a blank;
3) The lines from the n+2 to n+m+1 contain the information of votes; each line contains a string representing a vote;
4) The end of the file is -1.
Output

List the table of the first ten optimal teaching Fiends as shown in sample output.
Sample Input

15 30
08 Christopher Power&EnergyEngineering
02 Amanda MaterialsScience&Engineering
13 Matthew Chemistry&ChemicalTechnology
15 Sarah LifeScience&Biotechnology
05 Joshua Power&EnergyEngineering
06 Brittany ElectricPowerEngineering
07 Andrew HumanitiesandSocialScience
01 Megan MaterialsScience&Engineering
09 Daniel Management
04 Jennifer CivilEngineering&Mechanics
03 Justin Electronics&InformationTechnology
12 Nicole Chemistry&ChemicalTechnology
10 David Power&EnergyEngineering
14 Stephanie Chemistry&ChemicalTechnology
11 Ryan LifeScience&Biotechnology
01060503130412020009
07020905071308081015
01000000000000000000
00000200000112000006
12031301110402071306
15021413091211100603
15110314030406011412
03011110030312120114
08010409140206120513
08121206020601141214
11131506040914021402
05040711140506041413
09020204011009120214
07050613151209040414
10010410030309040514
11090113111114090110
06100307030808131510
09131505030801150611
15060509120610100111
11030613130909050701
12130409091402121402
03111411041508110909
01130112061109090408
12140507060809151314
12150811060915040702
11130607071007111408
12050714010205071214
09030603090108101313
15040615061107020608
02050202111309080506
-1
Sample Output

1 01 Megan MaterialsScience&Engineering 47 4 2 1 0 0 0 1 0 0 0 0
2 02 Amanda MaterialsScience&Engineering 29 4 0 1 1 0 0 1 0 1 0 0
3 06 Brittany ElectricPowerEngineering 19 4 0 1 0 0 0 0 1 0 1 1
4 12 Nicole Chemistry&ChemicalTechnology 16 4 0 0 0 0 0 1 2 1 0 0
5 14 Stephanie Chemistry&ChemicalTechnology 15 2 0 0 1 0 1 0 0 0 0 0
6 08 Christopher Power&EnergyEngineering 15 1 1 0 0 0 0 0 0 0 0 0
7 15 Sarah LifeScience&Biotechnology 15 1 1 0 0 0 0 0 0 0 0 0
8 09 Daniel Management 14 3 0 0 0 1 1 0 0 0 0 1
9 13 Matthew Chemistry&ChemicalTechnology 14 3 0 0 0 1 1 0 0 0 0 1
10 04 Jennifer CivilEngineering&Mechanics 14 2 0 0 1 0 0 1 0 0 0 0

  • 写回答

1条回答 默认 最新

  • devmiao 2017-10-30 09:03
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里