B - Plane of Tanks: Pro
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
4
artem noob
igor pro
kolya random
vasya random
3
vasya 200
kolya 1000
vasya 1000
2
kolya pro
vasya pro
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
using namespace std;
int main()
{
int i,j,k,n,x,sum,cnt;
string str;
map<string,int> score;
map<string,string> cate;
// scanf("%d",&n);
cin>>n;
while(n--)
{
cin>>str>>x;
if(score[str]<x)
score[str]=x;
}
map<string,int>::iterator it,it2;
cnt=score.size();
for(it=score.begin();it!=score.end();it++)
{
sum=;
for(it2=score.begin();it2!=score.end();it2++)
{
if(it->second<it2->second)
sum++;
}
double p=sum*1.0/cnt;
if(p>0.5)
cate[it->first]="noob";
else if(p>0.2&&p<=0.5)
cate[it->first]="random";
else if(p>0.1&&p<=0.2 )
cate[it->first]="average";
else if(p>0.01&&p<=0.1)
cate[it->first]="hardcore";
else
cate[it->first]="pro";
}
cout<<cnt<<endl;//忘记输出
for(map<string,string>::iterator tt=cate.begin();tt!=cate.end();tt++)
{
cout<<tt->first<<" "<<tt->second<<endl;
}
return ;
}
B - Plane of Tanks: Pro的更多相关文章
- 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/17 ...
- 【codeforces 175D】 Plane of Tanks: Duel
http://codeforces.com/problemset/problem/175/D (题目链接) 题意 A,B两人玩坦克大战,坦克有生命值,射击间隔,伤害范围,未命中的概率.问A赢的概率是多 ...
- Enterprise Solution 3.1 企业应用开发框架 .NET ERP/CRM/MIS 开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms
行业:基于数据库的制造行业管理软件,包含ERP.MRP.CRM.MIS.MES等企业管理软件 数据库平台:SQL Server 2005或以上 系统架构:C/S 开发技术 序号 领域 技术 1 数据库 ...
- vs生成pro
1.修改.vcxproj文件 <PropertyGroup Label="Globals"> <ProjectGuid>{AAAA4039-13B ...
- 高级渲染技巧和代码示例 GPU Pro 7
下载代码示例 移动设备正呈现着像素越来越高,屏幕尺寸越来越小的发展趋势. 由于像素着色的能耗非常大,因此 DPI 的增加以及移动设备固有的功耗受限环境为降低像素着色成本带来了巨大的压力. MSAA 有 ...
- 解析大型.NET ERP系统数据访问 对象关系映射框架LLBL Gen Pro
LLBL Gen Pro是一个为.NET开发人员设计的的对象关系映射(ORM)框架,与NHibernate,Entity Framework等框架一样,通过实体与数据表的映射,实现关系数据库持久化. ...
- LLBL Gen Pro 5.0 企业应用开发入门
Solutions Design 公司于2016年5月发布了LLBL Gen Pro 5.0,这个新版本的发布出乎于我的意料.我的猜想是从4.2升级到4.5,再升级5.x版本,主版本号的变更会给原有客 ...
- adobe premiere pro cc2015.0已停止工作 解决办法
adobe premiere pro cc2015.0已停止工作 一直报错 解决办法就是: 删除我的电脑 我的饿文档下的 Adobe下的Premiere Pro文件夹 现象就是怎么重新安装都不管用P ...
- 使用powershell批量添加Qt的文件(生成pro)
想使用QtCreator作为编辑器编辑keil或者IAR的工程,需要生成.pro文件,于是使用powershell批量处理. 源码如下: $incPath = dir -filter "*. ...
随机推荐
- Write a program to convert decimal to 32-bit unsigned binary.
Write a program to convert decimal to 32-bit unsigned binary. Write a program to convert a 32-bit un ...
- vijos P1213 80人环游世界(有源汇的上下界费用流)
[题目链接] https://vijos.org/p/1213 [题意] m个人将n个点访问完,每个点能且只能访问v次,点点之间存在有权边,问最小费用. [思路] 有源汇的上下界最小费用最大流. 每个 ...
- 微软Azure已开始支持hadoop--大数据云计算
微软Azure已开始支持hadoop,对于有需要弹性大数据运算的公司可能是个好消息.据悉,近期微软已提供一个预览版的Azure HDInsight(Hadoop on Azure)服务,运行在Linu ...
- 关于登录的会话控制, 终极解决方案 - chunyu
登录是用cookie还是session实现,一直有争议,普遍认为session更安全,可是有些功能,用cookie最方便也最高效,比如“记住我一周”. cookie还是session,我的答案是两 ...
- .NET中获取字符串的MD5码
C# 代码: 导入命名空间(需要在Web页面的代码页中引用) using System.Web.Security; 获取MD5码 string Password = FormsAuthenticati ...
- Calculating a bearing between points in location-aware apps
https://software.intel.com/en-us/blogs/2012/11/30/calculating-a-bearing-between-points-in-location-a ...
- 第二百七十一天 how can I 坚持
每天的内容应该是这个样子,做了什么,收获了什么,有哪些东西感动了你. 就像昨天看了个电影<解救吾先生>,看完没点感觉或感受是不可能的,刘德华扮演的吾先生最终获救,不仅仅是靠运气,多少还是因 ...
- BestCoder Round #71 (div.2) (hdu 5621)
KK's Point Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- UIPanGestureRecognizer
http://blog.csdn.net/huifeidexin_1/article/details/8282035 UIGestureRecognizer是一个定义基本手势的抽象类,具体什么手势,在 ...
- 第三方类AFNetworking
1.AFNetworking简介 AFNetworking是一个在iOS开发中使用非常多的轻量级网络开源库适用于iOS以及Mac OS X.它构建于在(Apple iOS开发文档) NSURLConn ...