首页 > 其他 > 详细

AC日记——T-Shirt Hunt codeforces 807b

时间:2017-05-11 19:21:38      阅读:359      评论:0      收藏:0      [点我收藏+]

T-Shirt Hunt

 

思路:

  水题;

 

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int p,x,y,ai[27],ans;

bool check(int xx)
{
    if(xx<y) return false;
    int i=(xx/50)%475;
    for(int j=1;j<=25;j++)
    {
        i=(i*96+42)%475;
        if(p==26+i) return true;
    }
    return false;
}

int main()
{
    scanf("%d%d%d",&p,&x,&y);
    int pos=x;
    while(pos>=y)
    {
        if(check(pos))
        {
            printf("0");
            return 0;
        }
        pos-=50;
    }
    while(x<y) x+=100,ans++;
    while(1)
    {
        if(check(x)||check(x-50))
        {
            printf("%d",ans);
            return 0;
        }
        x+=100,ans++;
    }
    return 0;
}

 

AC日记——T-Shirt Hunt codeforces 807b

原文:http://www.cnblogs.com/IUUUUUUUskyyy/p/6842182.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!