Codeforces807 B. T-Shirt Hunt 2017-05-08 23:23 175人阅读 评论(0) 收藏
2 seconds
256 megabytes
standard input
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?
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.
239 10880 9889
0
26 7258 6123
2
493 8000 8000
24
101 6800 6500
0
329 19913 19900
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.
——————————————————————————————————————
题目的意思是给出一个人的位置和他的分数和能获得第一的分数,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) 收藏的更多相关文章
- ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 175人阅读 评论(0) 收藏
一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...
- 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 ...
- 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 ...
- c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏
C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...
- .net 实现Office文件预览 Word PPT Excel 2015-01-23 08:47 63人阅读 评论(0) 收藏
先打个广告: .Net交流群:252713569 本人QQ :524808775 欢迎技术探讨, 近期公司要求上传的PPT和Word都需要可以在线预览.. 小弟我是从来没有接触过这一块的东西 感觉很棘 ...
- 百度地图-省市县联动加载地图 分类: Demo JavaScript 2015-04-26 13:08 530人阅读 评论(0) 收藏
在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过 ...
- 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 ...
- ASP.NET 自定义URL重写 分类: ASP.NET 2014-10-31 16:05 174人阅读 评论(0) 收藏
一.功能说明: 可以解决类似 http://****/news 情形,Url路径支持正则匹配. 二.操作步骤: 1.增加URL重写模块: using System; using System.IO; ...
- 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 ...
随机推荐
- Numpy 常用函数
保存文件i3 = eye(3) 创建一个3*3 的单位矩阵savetxt('eye.txt',i3) #保存矩阵 读取文件c,v=np.loadtxt('data.csv', delimiter=', ...
- Java http请求和调用(二)
http请求代码 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader ...
- Parametric Statistics
1.What are “Parametric Statistics”? 统计中的参数指的是总体的一个方面,而不是统计中的一个方面,后者指的是样本的一个方面.例如,总体均值是一个参数,而样本均值是一个统 ...
- blat
1) 产生背景---------------------------------------------------2002年的时候,随着人类基因组项目不断推进,需要将大量ESTs(300万) 及m ...
- 鼠标经过的图片高亮显示,其余变暗效果[xyytit]
初始代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...
- springmvc与struts2的不同
1.springmv的入口是一个servlet,即前端控制器.而struts2入口是一个fliter过滤器. 2.springmvc是基于开发方法(一个url对应一个方法,通过注解的方式进行访问),请 ...
- 将对象转为json,加入到HttpResponseMessage中
需要引用程序集: System.Net.Http System.Web System.Web.Extensions Code: using System; using System.Collectio ...
- Luogu 2154 [SDOI2009]虔诚的墓主人
弄了很久,状态很烂…… 首先发现可用的点一共只有$1e5$个,所以可以离散化坐标来方便计算. 发现对于一个空格,设它的上.下.左.右分别有$u, d, l, r$个点,它产生的贡献是$\binom{u ...
- Spark设计思想浅析
Spark is no rocket science!——博主 了解分布式计算的朋友,一定知道DAG这样一个概念.其实我接触DAG也是在学习MapReduce时了解到的.(具体可查阅<大数据日知 ...
- [BAT]cmd命令之 cd /d %~dp0
cd /d %~dp0是什么意思啊?批处理文件中的一条语句意思是 更改当前目录为批处理本身的目录 有些晕吧?不急,我举例 比如你有个批处理a.bat在D:\qq文件夹下 a.bat内容为 cd /d ...