hdu1014

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1014

 1    //hdu1014 0ms
 2 #include<stdio.h>
 3 #include<iostream>
 4 #include<algorithm>
 5 #include<string.h>
 6 using namespace std;
 7 
 8 int a[100010];
 9 
10 int main()
11 {
12     int n,m,flag,t;
13     a[0]=0;
14     while(scanf("%d %d",&n,&m)!=EOF)
15     {
16         flag=1;
17         t=0;
18         memset(a,0,sizeof(a));
19         a[0]=1;
20         for(int i=1;i<=m-1;i++)
21         {
22             t=(t+n)%m;
23             a[t]++;
24             if(a[t]>=2)
25             {
26                 flag=0;
27                 break;
28             }
29         }
30         if(flag)  
31             printf("%10d%10d    Good Choice

",n, m);  
32         else  
33             printf("%10d%10d    Bad Choice

",n, m);  
34     }
35     
36     return 0;
37  } 
原文地址:https://www.cnblogs.com/pter/p/4979170.html