Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (B) T-Shirt Hunt Solution In C/C++

#include <bits/stdc++.h>
using namespace std;
int p,x,y,i;
int luc(int s){
s = (s/50)%475;
for (int i=0;i<25;i++)
if((s=(s*96+42)%475)+26==p)return 1;
return 0;
}
int main(){
cin>>p>>x>>y;
for(i=x%50;!luc(i)||i<y;i+=50){}
return cout<<(i<=x?0:(i-x+99)/100),0;
}

(Visited 23 times, 1 visits today)

About the Author:

Leave A Comment