[c++]代码库
#include<iostream>
#include <iomanip>
#include<string>
using namespace std;
int main(){
int m, n;
int seed;
while(cin>>m>>n){
int count[100005] = {0};
seed = 0;
count[0] = 1;
for(int i = 1; i < n; i++){
seed = (seed + m) % n;
count[seed]++;
}
int flag = 1;
for(int i = 0; i < n; i++){
if(count[i] == 0){
flag = 0;
cout << setfill (' ') << setw (10)<<m;
cout << setfill (' ') << setw (10)<<n;
cout << setfill (' ') << setw (4)<<' ';
cout << "Bad Choice"<<endl<<endl;
break;
}
}
if(flag){
cout << setfill (' ') << setw (10)<<m;
cout << setfill (' ') << setw (10)<<n;
cout << setfill (' ') << setw (4)<<' ';
cout << "Good Choice"<<endl<<endl;
}
}
}