结构体+sort方法

╄→尐↘猪︶ㄣ 提交于 2019-12-23 10:35:15

昨天做了一道简单但很麻烦的题,我只能想到结构体,并用了STL的sort方法解决了它.不过从中有许多细节问题.

题目:

 

Problem Description

  Lcy wanted to choose 50 ACMers from m players to join HDU-ACM team.
He made n competitions , and now is your task to make the ranklist.
Here’re some instructions :
Effective score : the sum of the best n-2 competitions’ score.
One’s score in one competition : number of problems he(or she) solved divided the sum of problems all players solved.

The ranklist is made , of course , by the effective score , what if some players have the same score ?Follow these rules : girls always come first , same again and younger first , again ? In lexicographic order.

Input

  For each case , two integers in the first line : n (3<= n <= 10)and m(m<=1000)
The next m lines are someone’s information :
name , sex (F,M), grade and n integer numbers which means one’s number of solved problem in the ith competition.

Output

Output the first fifty players in order . Output all if m<50.

Sample Input

3 2
WXL F 08 3 4 5
HH M 08 3 4 5

Sample Output

WXL
HH

 

代码如下:

 

Code
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!