T-Shirt Hunt

思路:

  水题;

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; int p,x,y,ai[],ans; bool check(int xx)
{
if(xx<y) return false;
int i=(xx/)%;
for(int j=;j<=;j++)
{
i=(i*+)%;
if(p==+i) return true;
}
return false;
} int main()
{
scanf("%d%d%d",&p,&x,&y);
int pos=x;
while(pos>=y)
{
if(check(pos))
{
printf("");
return ;
}
pos-=;
}
while(x<y) x+=,ans++;
while()
{
if(check(x)||check(x-))
{
printf("%d",ans);
return ;
}
x+=,ans++;
}
return ;
}

AC日记——T-Shirt Hunt codeforces 807b的更多相关文章

  1. AC日记——Dynamic Problem Scoring codeforces 807d

    Dynamic Problem Scoring 思路: 水题: 代码: #include <cstdio> #include <cstring> #include <io ...

  2. AC日记——Sign on Fence Codeforces 484e

    E. Sign on Fence time limit per test 4 seconds memory limit per test 256 megabytes input standard in ...

  3. AC日记——Sagheer, the Hausmeister codeforces 812b

    812B - Sagheer, the Hausmeister 思路: 搜索: 代码: #include <cstdio> #include <cstring> #includ ...

  4. AC日记——Sagheer and Crossroads codeforces 812a

    812A - Sagheer and Crossroads 思路: 模拟: 代码: #include <cstdio> #include <cstring> #include ...

  5. AC日记——Is it rated? codeforces 807a

    Is it rated? 思路: 水题: 代码: #include <cstdio> #include <cstring> using namespace std; ],b[] ...

  6. Ac日记——Distances to Zero codeforces 803b

    803B - Distances to Zero 思路: 水题: 代码: #include <cstdio> #include <cstring> #include <i ...

  7. AC日记——Mice and Holes codeforces 797f

    797F - Mice and Holes 思路: XXYXX: 代码: #include <cmath> #include <cstdio> #include <cst ...

  8. AC日记——Roma and Poker codeforces 803e

    803E - Roma and Poker 思路: 赢或输或者平的序列: 赢和平的差的绝对值不得超过k: 结束时差的绝对值必须为k: 当“?”时可以自己决定为什么状态: 输出最终序列或者NO: dp( ...

  9. AC日记——Periodic RMQ Problem codeforces 803G

    G - Periodic RMQ Problem 思路: 题目给一段序列,然后序列复制很多次: 维护序列很多次后的性质: 线段树动态开点: 来,上代码: #include <cstdio> ...

随机推荐

  1. HDU 2139 Calculate the formula

    http://acm.hdu.edu.cn/showproblem.php?pid=2139 Problem Description You just need to calculate the su ...

  2. [转]dojo/mouse

    dojo/mouse Authors:Kris Zyp Project owner:Kris Zyp since:1.7.0 Contents Usage enter leave mouseButto ...

  3. web online ide &web online editor & web online playground & web online runtime

    web online ide &web online editor web online ide &web online editor & web online playgro ...

  4. JS Cookie相关操作

    function setCookie(cookieName, cookieValue, expires) { // 设置Cookie function getCookieName(cookieName ...

  5. UVA10480:Sabotage(最小割+输出)

    Sabotage 题目链接:https://vjudge.net/problem/UVA-10480 Description: The regime of a small but wealthy di ...

  6. 安卓topbar编码实战

    1.先在res->value下新建attrs.xml文件 <?xml version="1.0" encoding="utf-8"?> < ...

  7. Spring中Resource接口的前缀书写格式

    Resource template = ctx.getResource("classpath:some/resource/path/myTemplate.txt");   //这个 ...

  8. #error,在xib文件中拷贝按钮所造成的错误.

    https://www.evernote.com/shard/s227/sh/3e35a7b3-f40c-46df-8ae0-e7522310c18b/742311974127f12eaafae07a ...

  9. [bzoj2152]聪聪可可——点分治

    Brief Descirption 给定一棵带权树,您需要统计路径长度为3的倍数的路径长度 Algorithm Analyse 点分治. 考察经过重心的路径.统计出所有deep,统计即可. Code ...

  10. bzoj 2820 mobius反演

    学了一晚上mobius,终于A了一道了.... 假设枚举到i,质数枚举到p(程序里的prime[j]),要更新A=i*p的信息. 1. p|i    这时A的素数分解式中,p这一项的次数>=2. ...