【codeforces 807B】T-Shirt Hunt
【题目链接】:http://codeforces.com/contest/807/problem/B
【题意】
你在另外一场已经结束的比赛中有一个排名p;
然后你现在在进行另外一场比赛
然后你当前有一个分数x;
以及另外一个分数y,表示如果要拿第一需要的分数;
你可以通过hack使得分数x大于分数y;
然后你最后的分数x会决定你那个排名p能不能在已经结束的那场比赛中拿到奖品;
问你技能拿到奖品,又能在这场比赛中夺冠;至少需要hack成功多少次(失败的不需要输出);
(hack规则和cf的一样)
【题解】
如果x< y
则一直给x递增100;
则只要可以保证x>y,就能一直减50分;
然后看看你的分数能不能让你在第p名拿到奖品;
这种情况下,成功hack次数都为0,只是一直是失败的hack;
否则;
然后变回初始的x;
每次考虑hack成功一次以及hack成功和失败各一次的情况;
即+100和+50(这两种情况都是hack成功次数+1能覆盖的情况)
写个暴力就好;
判断分数为x的时候排名为P能不能拿到奖品,可以写个函数
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1e3+100;;
int p,x,y,cnt=0;
bool pd(int s)
{
int i = (s/50)%475;
rep1(j,1,25)
{
i = (i*96+42)% 475;
if (i+26==p) return true;
}
return false;
}
int main()
{
//freopen("F:\\rush.txt","r",stdin);
ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
cin >> p >> x >> y;
while (x<y)
{
x+=100;
cnt++;
}
int tx = x;
while (x-50>=y)
{
x-=50;
if (pd(x))
return cout << cnt << endl,0;
}
x = tx;
while (!pd(x))
{
cnt++;
x+=50;
if (pd(x)) break;
x+=50;
}
cout << cnt << endl;
return 0;
}
【codeforces 807B】T-Shirt Hunt的更多相关文章
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
- 【codeforces 709C】Letters Cyclic Shift
[题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...
- 【Codeforces 429D】 Tricky Function
[题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...
- 【Codeforces 670C】 Cinema
[题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...
- 【codeforces 515D】Drazil and Tiles
[题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...
随机推荐
- C# - Generics
Generics were added to version 2.0 of the C# language and the common language runtime (CLR). Generic ...
- Python查询数据库,中文的结果显示不出来
表里面的数据: 问题:查询数据库,返回结果不是中文可以,是中文的话就报错UnicodeEncodeError: 'gbk' codec can't encode character '\xd4' in ...
- [iOS]UITableViewController完毕收回键盘操作
UITableViewController 本身可以实现键盘适配(cell中控件焦点会移动到键盘上方 在做键盘收回的时候思考过例如以下方案 1.tableview加入点击事件 结果:点击事件和tabl ...
- 2016.04.19,英语,《Vocabulary Builder》Unit 16
top, comes from topos, the Greek word for 'place'. ectopic: [ek'tɑːpɪk] adj. [医]异位的,异常的 topical: ['t ...
- luogu2441 角色属性树
题目大意:维护一个可查询.修改的树,查询的是一个节点的:离它距离最近的.组成两个节点Key值的质因数存在交集的.祖先节点:修改是修改一个节点的key值. 如果组成两个Key值的质因数存在交集,则两个数 ...
- ListView模拟微信好友功能
ListView模拟微信好友功能 效果图: 分析: 1.创建listView 2.创建数据 3.创建适配器 将数据放到呈现数据的容器里面. 将这个容器(带数据)连接适配器. 其实是直接在我们自己写的a ...
- hdoj--2119--Matrix(最小点覆盖)
Matrix Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- 23. Merge k Sorted Lists[H]合并k个排序链表
题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity ...
- nodeJs配置相关以及JSON.parse
nodeJs配置相关 实际上说应用相关更好吧,我不是很懂. 今天在工作中,被同事解决了一个问题,虽然多花了一些额外时间,但长痛不如短痛嘛 实际上的问题就是npm run target等命令可以,但是n ...
- js 关于时间
var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); //获取完整的年份(4位,1970-???? ...