T-Shirt Hunt

微软机器翻译+人工
不久前, Codecraft-17 的比赛在 Codeforces 举行。排名前25名的参加者和另外随机在前500名的 25人,将收到 Codeforces t恤衫。‎

‎不幸的是, 您没有成功进入前 25, 但您进入了前 500, 排名‎p‎‎。‎

‎现在, 8VC 冒险杯2017的淘汰回合正在举行。已宣布, Codecraft-17 t恤优胜者将选择如下。让‎‎ ‎s‎‎是8VC 冒险投资杯2017的淘汰回合获胜者的点数。然后将执行以下伪代码:‎


i := (s div 50) mod 475
repeat 25 times:
i := (i * 96 + 42) mod 475
print (26 + i)

‎这里的 "‎‎div‎‎" 是整数除法运算符, "‎‎mod‎‎" 是模 (除法的余数) 运算符。‎

‎由于伪代码执行,会生成在26和500之间的25个整数,并打印。这些名次的参加者将得到 Codecraft-17 t恤衫。确保25打印的整数对‎‎ ‎‎s‎‎的任何值都是不同的。‎

‎您处于8VC 冒险杯2017的淘汰回合的领先地位, 具有‎‎ ‎‎x‎‎ ‎‎点。您认为在当前回合中至少具有‎‎ ‎‎y‎‎ ‎‎点将足以赢得胜利。‎

‎为了改变你的最后成绩, 你可以做任何数量的成功和失败。成功会给你带来100分, 失败会扣你50分。‎

‎你想赢得目前的回合, 并在同一时间, 确保得到一个 Codecraft-17 t恤衫。要实现此目的, 您必须成功的最小数目是多少?‎

Input

‎唯一的行包含三个整数‎‎ ‎‎p‎‎, ‎‎ ‎‎x‎‎ ‎‎和‎‎ ‎‎y‎‎ ‎‎ (‎‎26 ≤ ‎‎p‎‎ ≤ 500‎‎;‎‎1 ≤ ‎‎y‎‎ ≤ ‎‎x‎‎ ≤ 20000‎‎)-你在 Codecraft-17 的位置, 你目前在淘汰回合8VC 冒险杯 2017, 以及你认为足够的点数, 以赢得当前回合的分数。‎

Output

‎输出一个整数-你必须做的成功的最小数量, 使自己赢得淘汰回合8VC 冒险杯 2017, 并确保得到一个 Codecraft-17 t恤衫。‎

‎保证您的目标对于任何有效的输入数据都是可以实现的。‎

Example
Input
239 10880 9889
Output
0
Input
26 7258 6123
Output
2
Input
493 8000 8000
Output
24
Input
101 6800 6500
Output
0
Input
329 19913 19900
Output
8
Note

In the first example, there is no need to do any hacks since 10880 points already bring the T-shirt to the 239-th place of Codecraft-17 (that is, you). In this case, according to the pseudocode, the T-shirts will be given to the participants at the following places:


475 422 84 411 453 210 157 294 146 188 420 367 29 356 398 155 102 239 91 133 365 312 449 301 343

In the second example, you have to do two successful and one unsuccessful hack to make your score equal to 7408.

In the third example, you need to do as many as 24 successful hacks to make your score equal to 10400.

In the fourth example, it's sufficient to do 6 unsuccessful hacks (and no successful ones) to make your score equal to 6500, which is just enough for winning the current round and also getting the T-shirt.

有三种选择:-50,+50,+100,暴力一下就行
#include<iostream>
using namespace std;
bool judge(int p,int s)
{
	int i=(s/50)%475;
	for(int j=0;j<25;j++)
	{
		i=(i*96+42)%475;
		if(i+26==p)
			return true;
	}
    return false;
}
int main()
{
	int p,x,y;
	while(cin >> p >> x >> y)
	{
		bool flag=false;
		int fin=x,add=0;			
		while(fin>=y)
		{			
			if(judge(p,fin))
			{
				cout << 0 << endl;
				flag=true;
				break;
			}				
			fin-=50;
		}
		if(flag)
			continue;
		do
		{
			add+=50;
		}while(!judge(p,x+add));
		if(add%100==0)
			cout << add/100 << endl;
		else
			cout << add/100+1 << endl;
	}
	return 0;
}
最难的还是理解题意.......
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值