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 ...
随机推荐
- mysql 内存占用过多的解决方法
以下是5.6默认的设置performance_schema_max_table_instances 12500table_definition_cache 1400table_open_cache 2 ...
- How to Pronounce BEAUTIFUL
How to Pronounce BEAUTIFUL Share Tweet Share Tagged With: 3-Syllable Can you say this word beautiful ...
- MongoDB服务无法启动,发生服务特定错误:100
问题:MongoDB服务无法启动,发生服务特定错误:100 原因:没有正常关闭mongod服务,导致mongod被锁 解决方案:进入db文件夹,删除mongod.lock文件,然后重新启动服务即可
- 使用ecstore-sdk开发包制作易开店和启明星模板
前言: 尽管商派官网有模板开发教程,但是诸多方面太过笼统.我等平庸之辈,纵使细心研读,潜心修炼,亦未能品味练功境界,领悟其中真谛. 商派有云,此九阳真经不用您挥刀****本人却感觉此教程令人抓狂,无人 ...
- label文字从左上角开始
import UIKit class TextUpperLeftLabel: UILabel { override func textRect(forBounds bounds: CGRect, li ...
- jquery源码学习-构造函数(2)
最近几天一直在研究jquery源码,由于水平太低看得昏头转向.本来理解的也不是很深刻,下面就用自己的想法来说下jquery是如何定义构造函数初始化的.如果有什么不对的地方,希望个位高手指出. 一般写 ...
- ADF 入门帮助
本文是由英文帮助翻译所得: 1>task flows “任务流 task flows”可以包括非可视化的组件,比如方法调用.“页片段 page fragment”可以运行在一个页面的某个局部区域 ...
- sqlserver数据库维护常用sql
1.说明:创建数据库 CREATE DATABASE database-name 2.说明:删除数据库 drop database dbname 3.说明:备份sql server --- 创建 备份 ...
- UI设计行业中的“延禧攻略”,教你从青铜变王者
最近一直在追<延禧攻略>,女主魏璎珞敢爱敢恨,有仇必报的性格吸引不少人,她从低贱的秀坊小宫女步步为营,最终成为皇帝最宠爱的令妃呼风唤雨.尔虞我诈的后宫,想要打怪升级光有颜值是万万不够的,更 ...
- FEATURE_MCT_READERDIRECT问题
刚才查了一下,好像与一个叫CCID的驱动有关.你把FEATURE_MCT_READEDIRECT定义成0x08,再make一下试试.