ZOJ 3704 I am Nexus Master!

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 areT 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
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
模拟题 注意User这种类型 基本不会WA了

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include <map>
using namespace std;
map<string, int> M;
int T, a;
double b, c;
string s, S[100] = {"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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值