304229: CF807B. T-Shirt Hunt
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
T-Shirt Hunt
题目描述
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: `<br></br>i := (s div 50) mod 475<br></br>repeat 25 times:<br></br> i := (i * 96 + 42) mod 475<br></br> print (26 + i)<br></br>`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?输入输出格式
输入格式
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.
输出格式
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.
输入输出样例
输入样例 #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