【Codeforces 807 B. T-Shirt Hunt】
来源:互联网 发布:毕业论文的数据分析 编辑:程序博客网 时间:2024/06/05 16:15
B. T-Shirt Hunt
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
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?
Input
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
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.
Examples
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.
这真的是做的比较绕的题了 QAQ,首先分数至少为 y,其次最终的分数经过这个运算:
i := (s div 50) mod 475
repeat 25 times:
i := (i * 96 + 42) mod 475
print (26 + i);
要有一次 == p
1) x < y ,必须 +100
2) x > y,时判断下 , y =< o <= x,是否可行
3)剩下的只有 x += 100,并且判断下 x - 50是否可行
AC代码:
#include<cstdio>bool ok(int p,int x){ x = (x / 50) % 475; for(int i = 1; i <= 25; i++){ x = (x * 96 + 42) % 475; if(x + 26 == p) return true; } return false;}int main(){ int p,x,y; scanf("%d %d %d",&p,&x,&y); int num = 0,o = 0; while(x < y) x += 100,num++; int xx = x; while(xx >= y && !o) o = ok(p,xx),xx -= 50; while(!o){ o = ok(p,x); if(o) break; x += 100; num++; o = ok(p,x); if(o) break; o = ok(p,x - 50); } printf("%d\n",num); return 0;}
- 【Codeforces 807 B. T-Shirt Hunt】
- 807B T-Shirt Hunt
- 小白题解 Codeforces 807B T-Shirt Hunt
- Codeforces Round #412 B. T-Shirt Hunt
- codeforces 412 B T-shirt Hunt
- B. T-Shirt Hunt
- Codeforces Round #412 B. T-Shirt Hunt (暴力枚举)
- Codeforces807 B. T-Shirt Hunt
- CF#807 B. T-Shirt Hunt(水题)
- codeforces T-Shirt Hunt(傻瓜暴力)
- Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) B. T-Shirt Hunt(模拟)
- CodeForces 799B (B) T-shirt buying
- codeforces round #412 B. T-shirt buying
- Codeforces 799B T-shirt buying 题解
- Codeforces Round #413 B. T-shirt buying
- Codeforces Round #413 B. T-shirt buying
- codeforces #413 B T-shirt buying(set快速查找)
- codeforces 702F T-shirt
- ToolBar+Listview+EditText,类似微信聊天页面软键盘弹出问题
- oj 1608: 1!到n!的和(递归)
- 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。
- 链表查找
- js随机生成十六进制和rgb的颜色
- 【Codeforces 807 B. T-Shirt Hunt】
- finereport 组件
- 枚举+最小生成树 hdoj4081 Qin Shi Huang's National Road System
- pc:get 增加支持urlrule的解决办法
- 一个Swifter的Kotlin学习——Kotlin 基本语法
- Deepin Software编程
- Eclipse设置背景颜色、字体及代码提示
- 魔族密码(Vijos-1028)
- 教你快速使用AndroidStudio制作出一张合格.9图片