【打CF,学算法——一星级】CodeForces 74A Room Leader (水题)

根据简化后的Codeforces比赛规则,每个房间包含n名参赛者,他们在A到E五个问题中获得不同分数,并能互相破解获得额外积分。你需要找出房间里得分最高的参赛者,其得分考虑了成功和失败的破解次数以及解决问题的得分。题目提供了一个样例,展示了每个参赛者的得分情况,最终得出房间领导者是'tourist'。
摘要由CSDN通过智能技术生成

【CF简介】

提交链接:CF 74A


题面:

A. Room Leader
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document.

In the beginning of the round the contestants are divided into rooms. Each room contains exactlyn participants. During the contest the participants are suggested to solve five problems,A, B,C, D andE. For each of these problem, depending on when the given problem was solved and whether it was solved at all, the participants receive some points. Besides, a contestant can perform hacks on other contestants. For each successful hack a contestant earns 100 points, for each unsuccessful hack a contestant loses50 points. The number of points for every contestant is represented by the sum of points he has received from all his problems, including hacks.

You are suggested to determine the leader for some room; the leader is a participant who has maximum points.

Input

The first line contains an integer n, which is the number of contestants in the room (1 ≤ n ≤ 50). The nextn lines contain the participants of a given room. Thei-th line has the format of "handleiplusiminusiaibicidiei" — it is the handle of a contestant, the number of successful hacks, the number of unsuccessful hacks and the number of points he has received from problemsA, B,C, D,E correspondingly. The handle of each participant consists of Latin letters, digits and underscores and has the length from1 to 20 characters. There are the following limitations imposed upon the numbers:

  • 0 ≤ plusi, minusi ≤ 50;
  • 150 ≤ ai ≤ 500 orai = 0, if problemA is not solved;
  • 300 ≤ bi ≤ 1000 orbi = 0, if problemB is not solved;
  • 450 ≤ ci ≤ 1500 orci = 0, if problemC is not solved;
  • 600 ≤ di ≤ 2000 ordi = 0, if problemD is not solved;
  • 750 ≤ ei ≤ 2500 orei = 0, if problemE is not solved.

All the numbers are integer. All the participants have different handles. It is guaranteed that there is exactly one leader in the room (i.e. there are no two participants with the maximal number of points).

Output

Print on the single line the handle of the room leader.

Examples
Input
5
Petr 3 1 490 920 1000 1200 0
tourist 2 0 490 950 1100 1400 0
Egor 7 0 480 900 950 0 1000
c00lH4x0R 0 10 150 0 0 0 0
some_participant 2 1 450 720 900 0 0
Output
tourist
Note

The number of points that each participant from the example earns, are as follows:

  • Petr3860
  • tourist4140
  • Egor4030
  • c00lH4x0R - 350
  • some_participant 2220

Thus, the leader of the room is tourist.


题目大意:

     简化的CF得分规则,按得分排序,输出房间第一。


代码:

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#define sc store[i].score
#define LL long long
using namespace std;
struct per
{
	string name;
	int score;
}store[55];
bool cmp(per a,per b)
{
	return a.score>b.score;
}
int main()
{
	int n,tmp;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>store[i].name;
		cin>>tmp;
		sc=0;		
		sc+=tmp*100;
		cin>>tmp;
		sc-=tmp*50;
		for(int j=0;j<5;j++)
		{
			cin>>tmp;
			sc+=tmp;
		}
	}
	sort(store,store+n,cmp);
	cout<<store[0].name<<endl;
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值