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

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;
}
原文地址:https://www.cnblogs.com/IUUUUUUUskyyy/p/6842182.html