ZOJ 3704 I am Nexus Master!

来源:互联网 发布:windows激活工具原理 编辑:程序博客网 时间:2024/05/16 04:38

Description

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 10 6.

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.


纯模拟,需要注意的是user。

#include<cstdio>#include<algorithm>#include<vector>#include<cstring>#include<iostream>#include<string>#include<map>using namespace std;map<string, int> M;int T, a;double b, c;string s, S[10] = {"Peasant","User","Power_User","Elite_User","Crazy_User","Insane_User","Veteran_User","Extreme_User","Ultimate_User","Nexus_Master"};void begin(){scanf("%d", &T);for (int i = 0; i < 10; i++) M[S[i]] = i;}int check(int rank, int week, double down, double ratio){int u = 1;if (down >= 50 && ratio < 0.4) return 0;if (down >= 100 && ratio < 0.5) return 0;if (down >= 200 && ratio < 0.6) return 0;if (down >= 400 && ratio < 0.7) return 0;if (down >= 800 && ratio < 0.8) return 0;if (week >= 4 && down >= 50 && ratio >= 1.05) u = 2;if (week >= 8 && down >= 120 && ratio >= 1.55) u = 3;if (week >= 15 && down >= 300 && ratio >= 2.05) u = 4;if (week >= 25 && down >= 500 && ratio >= 2.55) u = 5;if (week >= 40 && down >= 750 && ratio >= 3.05) u = 6; if (week >= 60 && down >= 1024 && ratio >= 3.55) u = 7;if (week >= 80 && down >= 1536 && ratio >= 4.05) u = 8;if (week >= 100 && down >= 3072 && ratio >= 4.55) u = 9;if (rank == 9 && ratio < 4.45) rank--;if (rank == 8 && ratio < 3.95) rank--;if (rank == 7 && ratio < 3.45) rank--;if (rank == 6 && ratio < 2.95) rank--;if (rank == 5 && ratio < 2.45) rank--;if (rank == 4 && ratio < 1.95) rank--;if (rank == 3 && ratio < 1.45) rank--;if (rank == 2 && ratio < 0.95) rank--;return max(rank, u);}int main(){begin();while (T--){cin >> s >> a >> b >> c;cout << S[check(M[s], a, b, c / b)] << endl;}return 0;}


0 0
原创粉丝点击