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 "*. ...
随机推荐
- Kindle Paperwhite 2使用体验
博客开通后一懒就扔下了几十天,着实自惭.鉴于是第一篇,先说点题外话. 一转眼读研的生活已经过去一年有余.曾经的同学已经在职场拼搏,同龄人的生活状态也自然地带给自己一份紧迫感:不敢再贪恋校园生活的安逸, ...
- ArcMap10.1无法保存编辑的内容
问题描述:在arcMap10.1中编辑SDE库中要素,保存编辑内容时报错: 无法保存编辑内容.基础DBMS错误[ORA-29877:failed in the execution of the ODC ...
- Redis3.0 Install
Installation Download, extract and compile Redis with: $ wget http://download.redis.io/releases/redi ...
- Hadoop上路-03_Hadoop JavaAPI
一.Eclipse安装 1.下载解压 下载:http://www.eclipse.org/downloads/ 解压:SHELL$ sudo tar -zxvf eclipse.tar.gz 2.快捷 ...
- uva202:循环小数(循环节+抽屉原理)
题意: 给出两个数n,m,0<=n,m<=3000,输出n/m的循环小数表示以及循环节长度. 思路: 设立一个r[]数组记录循环小数,u[]记录每次的count,用于标记,小数计算可用 r ...
- cmake编译win下64位obs
obs是一款开源编码推流工具,简单易用,非常流行.一次项目中,发现本台式机I3处理器下32位obs推流CPU使用率100%.而使用的第三方设备在64位下,性能较好.所以需要编译64位obs并且编译相应 ...
- Nginx的代理和反向代理
什么是代理? 代理是为网络用户代理了来访问网络的,比如Google agent代理FQ. 什么是反向代理? 以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服 ...
- poj 1847 Tram
http://poj.org/problem?id=1847 这道题题意不太容易理解,n个车站,起点a,终点b:问从起点到终点需要转换开关的最少次数 开始的那个点不需要转换开关 数据: 3 2 1// ...
- [C语言 - 9] typedef
关键字typedef typedef 操作符可以看做是普通变量和类型之间的转换开关!! 例如 typedef int Integer;//定义了一种类型 int Integer;//定义了一个变量 ...
- java tools: jstack
SYNOPSIS jstack [ option ] pidclick here to see other detail If the given process is running on a 64 ...