ZOJ3704 I am Nexus Master! 2017-04-06 23:36 56人阅读 评论(0) 收藏
I am Nexus Master!
Time Limit: 2 Seconds Memory Limit: 65536 KB
NexusHD.org is a popular PT (Private Tracker) site in Zhejiang University aiming to provide high quality stuff. In order to encourage users to unload more stuff, the administrators
make the following rules to classified users into different classes by the uploaded/downloaded ratio and register time. Users with higher ranks will enjoy more privileges while users in the lowest class(Peasant) would be banned if they couldn't promote from
this class for a certain period.
The detail rules are as follows, referring to the FAQ page from NexusHD.org with some modification.
Class Title |
Description |
|
Peasant | User would be demoted to this class under any of the following circumstances: 1.Downloaded at least 50 GB and with ratio below 0.4 2.Downloaded at least 100 GB and with ratio below 0.5 3.Downloaded at least 200 GB and with ratio below 0.6 4.Downloaded at least 400 GB and with ratio below 0.7 5.Downloaded at least 800 GB and with ratio below 0.8 |
|
User | Default class. | |
Power_User | Been a member for at least 4 weeks, have downloaded at least 50GB and have a ratio at or above 1.05, and will be demoted from this status if ratio drops below 0.95. | |
Elite_User | Been a member for at least 8 weeks, have downloaded at least 120GB and have a ratio at or above 1.55, and will be demoted from this status if ratio drops below 1.45. | |
Crazy_User | Been a member for at least 15 weeks, have downloaded at least 300GB and have a ratio at or above 2.05, and will be demoted from this status if ratio drops below 1.95. | |
Insane_User | Been a member for at least 25 weeks, have downloaded at least 500GB and have a ratio at or above 2.55, and will be demoted from this status if ratio drops below 2.45. | |
Veteran_User | Been a member for at least 40 weeks, have downloaded at least 750GB and have a ratio at or above 3.05, and will be demoted from this status if ratio drops below 2.95. | |
Extreme_User | Been a member for at least 60 weeks, have downloaded at least 1TB and have a ratio at or above 3.55, and will be demoted from this status if ratio drops below 3.45. | |
Ultimate_User | Been a member for at least 80 weeks, have downloaded at least 1.5TB and have a ratio at or above 4.05, and will be demoted from this status if ratio drops below 3.95. | |
Nexus_Master | Been a member for at least 100 weeks, have downloaded at least 3TB and have a ratio at or above 4.55, and will be demoted from this status if ratio drops below 4.45. |
I am Nexus_Master, the highest class. And you, a young programmer, are asked to implement a small procedure to decide which class the user belongs to according to the above rules.
And this procedure will be invoked by main loop from time to time to modify the title of users. Maybe you will be gift a title after finishing this task.
The procedure would take four parameters of a single user as input: current class title, registration time, total downloaded, and total uploaded, and return a string as the new class
title of the user.
Input
The first line contains a single integer T (T ≤ 10000), indicating there are T cases in total.
There will be 4 parameters in each of the following T lines, as mentioned in the previous description :
- Current class title: one of the 10 titles in the detail rules;
- Register time: an non-negative integer representing the time span from the register moment to now, in unit of weeks;
- Total downloaded: a non-negative decimal number with 2 decimal digits after the decimal point, in unit of GBs;
- Total uploaded: a non-negative decimal number with 2 decimal digits after the decimal point, in unit of GBs.
Parameters are separated by a single space. All numerical parameters would not be greater than 106.
Outout
For each case, output the new class title of the user in a single line. Note that the tile should be one of the 10 titles in the above table.
Sample Input
3
Crazy_User 15 800.00 639.99
Veteran_User 45 1000.00 3000.00
Insane_User 45 1000.00 3000.00
Sample Output
Peasant
Veteran_User
Insane_User
Hint
——————————————————————————————————————————————————————
题目的意思是一个论坛有各种等级,给出当前等级和注册时间和下载量和上传量
求变动之后的等级,各种等级的关系如题目所给
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cctype>
#include <sstream>
#include <climits>
#include <unordered_map> using namespace std; #define LL long long
const int INF=0x3f3f3f3f;
map<string,int>mp; string ans[10]; void init()
{
mp["User"]=1;
mp["Power_User"]=2;
mp["Elite_User"]=3;
mp["Crazy_User"]=4;
mp["Insane_User"]=5;
mp["Veteran_User"]=6;
mp["Extreme_User"]=7;
mp["Ultimate_User"]=8;
mp["Nexus_Master"]=9;
ans[0]="Peasant";
ans[1]="User";
ans[2]="Power_User";
ans[3]="Elite_User";
ans[4]="Crazy_User";
ans[5]="Insane_User";
ans[6]="Veteran_User";
ans[7]="Extreme_User";
ans[8]="Ultimate_User";
ans[9]="Nexus_Master"; } int slove(int lv,double t,double d,double u)
{
double r=u/d;
int ran=1;
if(d>=50&&r<0.4) return 0;
if(d>=100&&r<0.5) return 0;
if(d>=200&&r<0.6) return 0;
if(d>=400&&r<0.7) return 0;
if(d>=800&&r<0.8) return 0;
if(t>=4&&d>=50&&r>=1.05) ran=2;
if(t>=8&&d>=120&&r>=1.55) ran=3;
if(t>=15&&d>=300&&r>=2.05) ran=4;
if(t>=25&&d>=500&&r>=2.55) ran=5;
if(t>=40&&d>=750&&r>=3.05) ran=6;
if(t>=60&&d>=1024&&r>=3.55) ran=7;
if(t>=80&&d>=1024*1.5&&r>=4.05) ran=8;
if(t>=100&&d>=1024*3&&r>=4.55) ran=9; if(lv==9&&r<4.45) lv--;
if(lv==8&&r<3.95) lv--;
if(lv==7&&r<3.45) lv--;
if(lv==6&&r<2.95) lv--;
if(lv==5&&r<2.45) lv--;
if(lv==4&&r<1.95) lv--;
if(lv==3&&r<1.45) lv--;
if(lv==2&&r<0.95) lv--;
return max(lv,ran);
} int main()
{
string s;
double time,u,d;
int T;
init();
scanf("%d",&T);
while(T--)
{
cin>>s>>time>>d>>u;
cout<<ans[slove(mp[s],time,d,u)]<<endl;
} return 0;
}
ZOJ3704 I am Nexus Master! 2017-04-06 23:36 56人阅读 评论(0) 收藏的更多相关文章
- Adding a WebPart to a SharePoint 2013 Master Page 分类: Sharepoint 2015-07-08 01:03 7人阅读 评论(0) 收藏
On SharePoint 2013 you can not add the Web Parts to the master page the same way of 2010. Please use ...
- Dungeon Master 分类: 搜索 POJ 2015-08-09 14:25 4人阅读 评论(0) 收藏
Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20995 Accepted: 8150 Descr ...
- cubieboard变身AP 分类: ubuntu cubieboard 2014-11-25 14:04 277人阅读 评论(0) 收藏
加载bcmdhd模块:# modprobe bcmdhd 如果你希望开启 AP 模式,那么:# modprobe bcmdhd op_mode=2 在/etc/modules文件内添加bcmdhd o ...
- HDU1551&&HDU1064 Cable master 2017-05-11 17:50 38人阅读 评论(0) 收藏
Cable master Time Limit: ...
- HDU6029 Graph Theory 2017-05-07 19:04 40人阅读 评论(0) 收藏
Graph Theory Time Limit: 2000/1000 M ...
- 2014/11/06 Oracle触发器初步 2014-11-06 09:03 49人阅读 评论(0) 收藏
触发器我就不多解释了,保证数据的完整性的神器,嗯..也是减少程序员工作托管给数据库操作的好帮手.就不讲一些大道理了.通俗点,我们对数据库的操作,无非就是增 删 改 查. 触发器就是在删,改,增的时候( ...
- hdu 1159, LCS, dynamic programming, recursive backtrack vs iterative backtrack vs incremental, C++ 分类: hdoj 2015-07-10 04:14 112人阅读 评论(0) 收藏
thanks prof. Abhiram Ranade for his vedio on Longest Common Subsequence 's back track search view in ...
- NPOI 通用导出数据到Excel 分类: C# Helper 2014-11-04 16:06 246人阅读 评论(0) 收藏
应用场景: 在项目中,经常遇到将数据库数据导出到Excel,针对这种情况做了个程序封装.工作原理:利用NPOI将SQL语句查询出的DataTable数据导出到Excel,所见即所得. 程序界面: ...
- cloud theory is a failure? 分类: Cloud Computing 2013-12-26 06:52 269人阅读 评论(0) 收藏
since LTE came out, with thin client cloud computing and broadband communication clouding 不攻自破了.but ...
随机推荐
- oracle 锁表/解锁 杀进程
一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库.现在提供一种方法解决这种问题,那就是在ORACLE中杀不 ...
- [C++ Primer] 第9章: 顺序容器
顺序容器概述 顺序容器的类型有: 类型 说明 vector 可变长度数组. 支持快速随机访问. deque 双端队列. 支持快速随机访问. list 双向链表. 只支持双向顺序访问. forward_ ...
- nginx 自签名证书 配置 https
最近在研究nginx,整好遇到一个需求就是希望服务器与客户端之间传输内容是加密的,防止中间监听泄露信息,但是去证书服务商那边申请证书又不合算,因为访问服务器的都是内部人士,所以自己给自己颁发证书,忽略 ...
- (转)Eclipse新增安卓虚拟机
- Bootstrap-Plugin:模态框(Modal)插件
ylbtech-Bootstrap-Plugin:模态框(Modal)插件 1.返回顶部 1. Bootstrap 模态框(Modal)插件 模态框(Modal)是覆盖在父窗体上的子窗体.通常,目的是 ...
- 思科、华为、H3C命令对照表
思科 华为 H3C 描述 no undo undo 取消/关闭 当前设置 show display display 查看.显示 exit quit quit 退回上级 hostname sysname ...
- UI“三重天”之selenium--常用API和问题处理(三)
Selenium常用API: 前面两篇示例代码中用到了一些selenium的API方法,例如定位元素的八种方法.访问url.等待.操作浏览器.获取title.点击.清理等等. 有关于selenium的 ...
- 第11课 Qt中的字符串类
1. 历史遗留问题和解决方案 (1)历史遗留问题 ①C语言不支持真正意义上的字符串 ②C语言用字符数组和一组函数实现字符串操作 ③C语言不支持自定义类型,因此无法获得字符串类型 (2)解决方案 ①从C ...
- 使用docker快速搭建环境-安装mysql
install docker sudo apt-get install -y docker.io download mysql sudo docker pull mysql start mysql s ...
- 基于git的管理应用程序基线包和版本
由于工作的需要,身为git的小白的我开始研究git相关的命令和操作.结合网上收集和廖雪峰的git教程,记录所学知识点. 相关的效果就不再这里显示了. 首先我们看一下git的常用命令: 常用命令 git ...