hdu 1014 Uniform Generator
//不难的模拟
#include<stdio.h> #include<string.h> int main(void) { int mod,seed[100005]={0},step,flag[100005],i; while(scanf("%d%d",&step,&mod)!=EOF) { memset(flag,-1,sizeof(flag)); flag[0]=1; for(i=1;i<mod;i++) seed[i]=(seed[i-1]+step)%mod,flag[seed[i]]=1; for(i=0;i<mod;i++) if(flag[i]==-1) break; if(i==mod) printf("%10d%10d Good Choice\n\n",step,mod); else printf("%10d%10d Bad Choice\n\n",step,mod); } return 0; }