根据循环群的知识,step的生成群的周期为n/gcd(step,n),所以,只有当gcd(step,n)=1时,才是一个good choice 代码: #include<iostream> #include<cstdio> #include<memory.h> using namespace std; __int64 gcd(__int64 a,__int64 b) { if(b==0) return a; else return gcd(b,a%b); } int main() { __int64 a,b,d; while(scanf("%I64d%I64d",&a,&b)!=EOF) { d=gcd(a,b); printf("%10I64d%10I64d ",a,b); if(d!=1) printf("Bad Choice/n"); else printf("Good Choice/n"); printf("/n"); } return 0; }