解题记录:Champion

题目:
A problem is solved when it is accepted by the judges. The judges are solely responsible for accepting or rejecting submitted runs. In consultation with the judges, the Regional Contest Director determines the winners of the regional contest. The regional contest director and judges are empowered to adjust for or adjudicate unforeseen events and conditions. Their decisions are final. Teams are ranked according to the most problems solved. For the purposes of awards, or in determining qualifier(s) for the World Finals, teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty minutes for every rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved. Now,write a program to tell us which team will be the champion! You can assume that there will be no possibility that two or more teams get the first place!

输入:
The input consists of multiple test cases.The first line have one integer N(0< N< 150): the numbers of the team(the team id is from 1 to N). The next N lines give the numbers of the problem solved and the time elapsed.
The input is terminated with one 0. This test case shoud not be processed.

输出:
For each test case,printf in one line that the champion team’s id!

样例输入:

5
5 300
4 250
6 412
7 459
2 100
0

样例输出:

4

我的代码:http://putpan.com/fs/a5f1a29081581429269/


猜你喜欢

转载自blog.csdn.net/weixin_43751110/article/details/86670981