Codeforces Round #115 B. Plane of Tanks: Pro 水题
B. Plane of Tanks: Pro
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/175/problem/B
Description
Vasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results.
A player is given a non-negative integer number of points in each round of the Plane of Tanks. Vasya wrote results for each round of the last year. He has n records in total.
In order to determine a player's category consider the best result obtained by the player and the best results of other players. The player belongs to category:
- "noob" — if more than 50% of players have better results;
- "random" — if his result is not worse than the result that 50% of players have, but more than 20% of players have better results;
- "average" — if his result is not worse than the result that 80% of players have, but more than 10% of players have better results;
- "hardcore" — if his result is not worse than the result that 90% of players have, but more than 1% of players have better results;
- "pro" — if his result is not worse than the result that 99% of players have.
When the percentage is calculated the player himself is taken into account. That means that if two players played the game and the first one gained 100 points and the second one 1000 points, then the first player's result is not worse than the result that 50% of players have, and the second one is not worse than the result that 100% of players have.
Vasya gave you the last year Plane of Tanks results. Help Vasya determine each player's category.
Input
The first line contains the only integer number n (1 ≤ n ≤ 1000) — a number of records with the players' results.
Each of the next n lines contains a player's name and the amount of points, obtained by the player for the round, separated with a space. The name contains not less than 1 and no more than 10 characters. The name consists of lowercase Latin letters only. It is guaranteed that any two different players have different names. The amount of points, obtained by the player for the round, is a non-negative integer number and does not exceed 1000.
.
Output
Print on the first line the number m — the number of players, who participated in one round at least.
Each one of the next m lines should contain a player name and a category he belongs to, separated with space. Category can be one of the following: "noob", "random", "average", "hardcore" or "pro" (without quotes). The name of each player should be printed only once. Player names with respective categories can be printed in an arbitrary order.
Sample Input
5
vasya 100
vasya 200
artem 100
kolya 200
igor 250
Sample Output
4
artem noob
igor pro
kolya random
vasya random
HINT
题意
给你n个数据,每个数据有名字和分数,但是只用考虑最高分数
如果这个人的分数比99%的人都高,那就是pro
。。。。(然后读题,读题
然后让你输出有多少个人,并且把每个人获得的称号输出
题解:
水题咯,直接n^2就好了~
代码:
#include<iostream>
#include<stdio.h>
#include<map>
#include<iostream>
using namespace std; map<string,int> H;
string s;
int p;
int main()
{
int n;scanf("%d",&n);
for(int i=;i<n;i++)
{
cin>>s>>p;
H[s]=max(p,H[s]);
}
map<string,int>::iterator it1;
cout<<H.size()<<endl;
for(it1=H.begin();it1!=H.end();it1++)
{
map<string,int>::iterator it2;
int p = ;
for(it2=H.begin();it2!=H.end();it2++)
if(it1->second>=it2->second)
p++;
p = p * / H.size();
if(p>=)cout<<it1->first<<" pro"<<endl;
else if(p>=)cout<<it1->first<<" hardcore"<<endl;
else if(p>=)cout<<it1->first<<" average"<<endl;
else if(p>=)cout<<it1->first<<" random"<<endl;
else cout<<it1->first<<" noob"<<endl;
}
}
Codeforces Round #115 B. Plane of Tanks: Pro 水题的更多相关文章
- Codeforces Round #367 (Div. 2) A. Beru-taxi (水题)
Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b ...
- Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题
A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...
- Codeforces Round #353 (Div. 2) A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/675/problem/A Description Vasya likes e ...
- Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题
A. Wizards' Duel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/prob ...
- Codeforces Round #146 (Div. 1) A. LCM Challenge 水题
A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I ...
- Codeforces Round #335 (Div. 2) B. Testing Robots 水题
B. Testing Robots Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606 ...
- Codeforces Round #335 (Div. 2) A. Magic Spheres 水题
A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...
- Codeforces Round #306 (Div. 2) A. Two Substrings 水题
A. Two Substrings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/pro ...
- Codeforces Round #188 (Div. 2) A. Even Odds 水题
A. Even Odds Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/problem/ ...
随机推荐
- 【转】UITableView详解(UITableViewCell
原文网址:http://www.kancloud.cn/digest/ios-1/107420 上一节中,我们定义的cell比较单一,只是单调的输入文本和插入图片,但是在实际开发中,有的cell上面有 ...
- Spring各jar包的作用(转载)
spring.jar是包含有完整发布的单个jar 包,spring.jar中包含除了spring-mock.jar里所包含的内容外其它所有jar包的内容,因为只有在开发环境下才会用到 spring-m ...
- 面试题 IQ
现在有一大块金条,它可以分为七小块金条.是这样子的,工人为你工作7天,每天都将获得一小块金条,你要做的就是发工资,切割大块金条的次数最多两次,你有什么方法让工人每天都获得一小块金条呢?
- String.IsNullOrEmpty 方法
参数 value:一个String引用 返回值 如果 value 参数为 空引用(在 Visual Basic 中为 Nothing) 或空字符串 (""),则为 true:否则为 ...
- 只用css实现“每列四行,加载完一列后数据自动填充到下一列”的效果
只用css实现“每列四行,加载完一列后数据自动填充到下一列”的效果.这个题目用图表示如下: 如果将题目换成“只用css实现每行四列,加载完一行后数据自动填充到下一行”,那这个问题就简单多了,相信大家都 ...
- HDU5764 After a Sleepless Night 树形乱搞题
分析(官方题解): 假设根已确定,可以发现新树若合法,需满足以下性质:根节点是n:儿子的值不大于父亲:具有相同值的节点形成一条链,并且链不会发生“分叉”(即有多个最低点).所以对于新树中有出现的值x, ...
- mybatis系列-11-一对多查询
11.1 需求 查询订单及订单明细的信息. 11.2 sql语句 确定主查询表:订单表 确定关联查询表:订单明细表 在一对一查询基础上添加订单明细表关联即可. SELECT order ...
- 【转】MySql数据库--mysql_real_escape_string()函数
MySql数据库--mysql_real_escape_string()函数 unsigned long mysql_real_escape_string(MYSQL *mysql, char *to ...
- Intellij IDEA使用Maven构建Scala项目
1.安装IDEA的Scala插件 使用自带的在线安装方式较为简单.File--Setting--Plugins--Browse reposities 2.创建项目 File - ...
- 第二百九十四天 how can I 坚持
这是怎么了,好难受,晚上都没吃饭,全身都疼.该咋办. 其实,真的是身体最重要. 洗洗睡了.好难受.