杭电1014 Uniform Generator

/********************************
* 日期:2011-2-7
* 作者:SJF
* 题号:杭电1014
* 题目:Uniform Generator
* 结果:AC
********************************/
#include <stdio.h>
int main()
{
long int STEP,MOD;
while(scanf("%ld%ld",&STEP,&MOD)!=EOF)
{
int k=1,count=1,M,N;
long int seed[100000];
seed[0]=0;
seed[k]=(seed[k-1]+STEP)%MOD;
while(seed[k]!=seed[0])
{
k++;
seed[k]=(seed[k-1]+STEP)%MOD;
count++;
}
if(count==MOD)
{
printf("%10ld%10ld Good Choice\n\n",STEP,MOD);
}
else
{
printf("%10ld%10ld Bad Choice\n\n",STEP,MOD);
}
}
return 0;
}

你可能感兴趣的:(generator)