B. T-Shirt Hunt
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard 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 px 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.

——————————————————————————————————————

题目的意思是给出一个人的位置和他的分数和能获得第一的分数,hack成功一发+100

分,失败一发-50分,求他拿第一且领到衣服至少要成功多少发(失败不算),拿衣服的

位置有他的分数经伪代码处理得到

思路:先算出拿第一至少要拿多少分,在判断只失败能否达成条件,若不能则每次加50

分(+50和+100都是一次hack),直到可以位置

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <functional> using namespace std; #define LL long long
const int INF=0x3f3f3f3f;
int p,x,y; bool ok(int n)
{
int s=(n/50)%475;
for(int i=0;i<25;i++)
{
s=(s*96+42)%475;
if(s+26==p)
return 1;
}
return 0;
} int main()
{ scanf("%d%d%d",&p,&x,&y);
int ans=0;
if(x<y)
ans+=(y-x+99)/100;
x+=ans*100;
int xx=x;
while(xx>=y)
{
if(ok(xx))
{
printf("%d\n",ans);
return 0;
}
xx-=50;
} int cnt=0;
while(1)
{
if(ok(x+cnt*50))
{
break;
}
cnt++;
}
ans=ans+(cnt+1)/2;
printf("%d\n",ans);
return 0;
}

Codeforces807 B. T-Shirt Hunt 2017-05-08 23:23 175人阅读 评论(0) 收藏的更多相关文章

  1. ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 175人阅读 评论(0) 收藏

    一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...

  2. Codeforces807 C. Success Rate 2017-05-08 23:27 91人阅读 评论(0) 收藏

    C. Success Rate time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  3. Codeforces807 A. Is it rated? 2017-05-08 23:03 177人阅读 评论(0) 收藏

    A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  4. c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏

    C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...

  5. .net 实现Office文件预览 Word PPT Excel 2015-01-23 08:47 63人阅读 评论(0) 收藏

    先打个广告: .Net交流群:252713569 本人QQ :524808775 欢迎技术探讨, 近期公司要求上传的PPT和Word都需要可以在线预览.. 小弟我是从来没有接触过这一块的东西 感觉很棘 ...

  6. 百度地图-省市县联动加载地图 分类: Demo JavaScript 2015-04-26 13:08 530人阅读 评论(0) 收藏

    在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过 ...

  7. walk around by The provided App differs from another App with the same version and product ID 分类: Sharepoint 2015-07-05 08:14 4人阅读 评论(0) 收藏

    'm currently developing a SharePoint 2013 application. After a few deployments via Visual Studio, I ...

  8. ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 174人阅读 评论(0) 收藏

    一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...

  9. hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos) 分类: hdoj 2015-06-18 08:21 39人阅读 评论(0) 收藏

    errors made, boundary conditions, <= vs < , decreasing vs increasing , ++, –, '0'/'1' vs 0/1 p ...

随机推荐

  1. python中时间差中seconds和total_seconds

    在python中经常会用到计算两个时间差,两个日期类型进行相减可以获取到时间差 经常会使用seconds来获取,其实seconds获取的是时间差的秒数,遗漏了天 seconds是获取时间部分的差值,而 ...

  2. conductor介绍

    https://netflix.github.io/conductor/ https://github.com/Netflix/conductor 编译版: https://jcenter.bintr ...

  3. canvas 移动光速特效-

    http://pan.baidu.com/s/1cHtABO 密码:istl

  4. css3 fileter始终效果 图片渲染

    http://www.w3cplus.com/css3/ten-effects-with-css3-filter

  5. .NET中的文件IO操作实例

    1.写入文件代码: //1.1 生成文件名和设置文件物理路径 Random random = new Random(DateTime.Now.Millisecond); ); string Physi ...

  6. 浅谈QT打印功能实现

    QT作为一款轻量级的集成开发环境,其设计的目标是使开发人员利用QT这个应用程序框架更加快速及轻易的开发应用程序.要达到此目的,要求QT必须能够跨平台,QT能够在32位及64位的Linux,MAC OS ...

  7. Jmeter元件作用域

    转载自飞测团队

  8. eclipse奇怪问题之端口占用记录

    启动程序报端口占用(实际并没有启动占用端口的程序) 打开cmd查找占用端口的进程能查到,但又无法杀掉(命令和任务管理器都杀不掉),用了PCHunter(xuetr)结束进程后还会刷新还会重新出现 重启 ...

  9. mybatis sql语句符号问题

    写sql语句<或>不能直接写,而应写作<或>,不然项目不能正常编译启动

  10. webkit开源项目

    WebKitOpen Source Web Browser Engine Blog Downloads Feature Status Reporting Bugs Contribute Getting ...