博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #115 B. Plane of Tanks: Pro 水题
阅读量:4993 次
发布时间:2019-06-12

本文共 3470 字,大约阅读时间需要 11 分钟。

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
#include
#include
#include
using namespace std;map
H;string s;int p;int main(){ int n;scanf("%d",&n); for(int i=0;i
>s>>p; H[s]=max(p,H[s]); } map
::iterator it1; cout<
<
::iterator it2; int p = 0; for(it2=H.begin();it2!=H.end();it2++) if(it1->second>=it2->second) p++; p = p * 100 / H.size(); if(p>=99)cout<
first<<" pro"<
=90)cout<
first<<" hardcore"<
=80)cout<
first<<" average"<
=50)cout<
first<<" random"<
first<<" noob"<

 

转载于:https://www.cnblogs.com/qscqesze/p/4991364.html

你可能感兴趣的文章
番茄时间
查看>>
四位计算机的原理及其实现【转】
查看>>
mediawiki简易安装文档
查看>>
Ubuntu server 命令备忘
查看>>
yum常用操作
查看>>
MES系统框架及MES开源框架|C/S框架网软著产品
查看>>
以boost::function和boost:bind取代虚函数
查看>>
linux 下启动SVN服务
查看>>
vue框架学习
查看>>
现代计算机接口实验 (三)8255实验
查看>>
spring——获取ClassLoader
查看>>
javascript函数
查看>>
luogu4093 序列 (cdq分治优化dp)
查看>>
BZOJ 2588: Spoj 10628. Count on a tree( LCA + 主席树 )
查看>>
从零开始学算法(一)
查看>>
d3d 纹理坐标1:1对应到屏幕坐标.
查看>>
SQL Server优化器特性-隐式谓词
查看>>
国内不谈Java--硅谷有感
查看>>
hdu3371
查看>>
zoj1456 Minimum Transport Cost
查看>>