Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 22610 Accepted Submission(s): 8889
#include<stdio.h>
#include<string.h>
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
printf("%10d%10d ",n,m);
int a[100005],i,j,k,p,q,b[100005];
a[0]=0;
memset(b,0,sizeof(b));
b[0]=1;
for(i=1; i<m; i++)
{
a[i]=(a[i-1]+n)%m;
b[a[i]]++;
if(b[a[i]]==2)
{
printf("Bad Choice\n\n");
break;
}
}
if(i==m)
printf("Good Choice\n\n");
}
return 0;
}
原文:http://www.cnblogs.com/-lgh/p/4993135.html