ZOJ3704-I am Nexus Master!
来源:互联网 发布:算法高清完整版pdf 编辑:程序博客网 时间:2024/06/05 04:46
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.
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.
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
3Crazy_User 15 800.00 639.99Veteran_User 45 1000.00 3000.00Insane_User 45 1000.00 3000.00
Sample Output
PeasantVeteran_UserInsane_User
Hint
1 TB = 1024 GB.
Author: WANG, Yelei
Contest: The 13th Zhejiang University Programming Contest
题意:有一个判定用户等级的系统,现在不同的等级有不同的评价标准,给出当前等级和注册时间和下载量和上传量,求变动之后的等级
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <cmath>#include <queue>#include <vector>#include <set>#include <stack>#include <map>#include <climits>using namespace std;#define LL long longconst 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!
- ZOJ3704-I am Nexus Master!
- ZOJ 3704 I am Nexus Master!
- ZOJ 3704 I am Nexus Master!
- i am
- I am who I am
- I am what i am
- everyone I am Hello everyone I am
- I AM ARRIVAL, I AM COMING.
- Who am I?
- who am i
- I am new
- Here I am(Lyrics)
- I am free again
- Here I am
- I Am Fortunate Indeed
- I am Furled today!
- Who I am
- arm芯片,远程空中升级程序技术方案
- Java内存机制以及Android内存优化
- [HDU4010]Query on The Trees-动态树LCT(Link Cut Tree)
- -JAVA-集合(一)
- Github入门教程
- ZOJ3704-I am Nexus Master!
- 蓝桥杯——数字排列(dfs)
- 数据库的导出与导入
- Android odex反编译为dex
- linux内核编程(hello world示例程序)
- 动态库的制作
- linux crontab简单使用
- spark学习笔记1一20170407
- 数据分析与数据挖掘面试题收集