CF807B.T-Shirt Hunt
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Not so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt.
Unfortunately, you didn't manage to get into top 25, but you got into top 500, taking place p.
Now the elimination round of 8VC Venture Cup 2017 is being held. It has been announced that the Codecraft-17 T-shirt winners will be chosen as follows. Let s be the number of points of the winner of the elimination round of 8VC Venture Cup 2017. Then the following pseudocode will be executed:
i := (s div 50) mod 475
repeat 25 times:
i := (i * 96 + 42) mod 475
print (26 + i)
Here "div" is the integer division operator, "mod" is the modulo (the remainder of division) operator.
As the result of pseudocode execution, 25 integers between 26 and 500, inclusive, will be printed. These will be the numbers of places of the participants who get the Codecraft-17 T-shirts. It is guaranteed that the 25 printed integers will be pairwise distinct for any value of s.
You're in the lead of the elimination round of 8VC Venture Cup 2017, having x points. You believe that having at least y points in the current round will be enough for victory.
To change your final score, you can make any number of successful and unsuccessful hacks. A successful hack brings you 100 points, an unsuccessful one takes 50 points from you. It's difficult to do successful hacks, though.
You want to win the current round and, at the same time, ensure getting a Codecraft-17 T-shirt. What is the smallest number of successful hacks you have to do to achieve that?
就在不久前,Codeforces 举办了 Codecraft-17 编程竞赛。前 25 名选手,以及在前 500 名中随机抽取的另外 25 名选手,将获得一件 Codeforces T 恤。
很遗憾,你未能进入前 25 名,但成功进入了前 500 名,最终排名为第 p 名。
目前,8VC Venture Cup 2017 的淘汰赛正在举行。官方已宣布:Codecraft-17 T 恤的获奖者将按如下方式选出。设 s 为 8VC Venture Cup 2017 淘汰赛冠军的得分,则将执行以下伪代码:
i := (s div 50) mod 475
repeat 25 times:
i := (i \* 96 + 42) mod 475
print (26 + i)
其中,“div” 表示整数除法运算符,“mod” 表示取模(即除法的余数)运算符。
该伪代码执行后,将输出 25 个介于 26 到 500(含端点)之间的整数。这些整数即为获得 Codecraft-17 T 恤的参赛者的名次。对于任意 s 值,这 25 个输出的整数两两互不相同(题目保证)。
你目前在 8VC Venture Cup 2017 淘汰赛中排名第一,当前得分为 x 分。你相信,只要本轮最终得分至少达到 y 分,就足以确保夺冠。
你可以通过任意次数的成功/失败的 hack 来调整你的最终得分:一次成功的 hack 为你增加 100 分,一次失败的 hack 则扣除你 50 分。不过,成功完成 hack 是比较困难的。
你希望既赢得本轮比赛,又确保能获得一件 Codecraft-17 T 恤。那么,为达成这一目标,你最少需要完成多少次成功的 hack?
输入格式
The only line contains three integers p, x and y (26 ≤ p ≤ 500; 1 ≤ y ≤ x ≤ 20000) — your place in Codecraft-17, your current score in the elimination round of 8VC Venture Cup 2017, and the smallest number of points you consider sufficient for winning the current round.
唯一的一行包含三个整数 p、x 和 y(26 ≤ p ≤ 500;1 ≤ y ≤ x ≤ 20000)—— 分别表示你在 Codecraft-17 中的排名、你在 8VC Venture Cup 2017 淘汰赛轮次中的当前得分,以及你认为赢得本轮所需的最低分数。
输出格式
Output a single integer — the smallest number of successful hacks you have to do in order to both win the elimination round of 8VC Venture Cup 2017 and ensure getting a Codecraft-17 T-shirt.
It's guaranteed that your goal is achievable for any valid input data.
输出一个整数——为赢得 2017 年 8VC Venture Cup 淘汰赛并确保获得 Codecraft-17 T 恤,你必须完成的最少成功 hack 次数。
对于任意合法的输入数据,保证你的目标均可实现。
输入输出样例
输入#1
239 10880 9889
输出#1
0
输入#2
26 7258 6123
输出#2
2
输入#3
493 8000 8000
输出#3
24
输入#4
101 6800 6500
输出#4
0
输入#5
329 19913 19900
输出#5
8
说明/提示
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.
在第一个例子中,无需进行任何黑客攻击,因为 10880 分已足以使你获得 Codecraft-17 的第 239 名(即你的名次)。此时,根据伪代码,T 恤将发放给以下名次的参赛者:
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
在第二个例子中,你需要进行两次成功的黑客攻击和一次失败的黑客攻击,使你的得分恰好为 7408。
在第三个例子中,你需要进行多达 24 次成功的黑客攻击,使你的得分恰好为 10400。
在第四个例子中,仅需进行 6 次失败的黑客攻击(无需任何成功的黑客攻击),即可使你的得分恰好为 6500,这足以赢得当前轮次并获得 T 恤。
输入解题思路,AI测评打分。不知道怎么写?