hdu1014(水~)

#include<stdio.h>

#include<string.h>

#define N 100000+5

int step,mod,seed;

int flag;

int f[N];



int main(){

	int i,j,k;

	while(scanf("%d%d",&step,&mod)==2){

		for(i=0;i<=mod-1;i++)

			f[i]=0;

		seed=0;

		do

		{

			seed=(seed+step)%mod;		

			f[seed]=1;

		}while(seed!=0);



		flag=0;

		for(i=0;i<=mod-1;i++)

			if(f[i]==0){

				flag=1;

				break;

			}

		if(flag==1)

			printf("%10d%10d    Bad Choice\n\n",step,mod);

		else

			 printf("%10d%10d    Good Choice\n\n",step,mod);

	}

	return 0;

}

  

你可能感兴趣的:(HDU)