杭电1014题
//使用双链表list实现
#include <list>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int step,mod;
char good[20]="Good Choice";
char bad[20] = "Bad Choice";
while(cin>>step>>mod)
{
list<int> listobject;
int seed=0;
while(1)
{
listobject.push_back(seed);
seed = (seed + step)% mod;
//格式化输出
if(listobject.size()== mod)
{
printf("%10d%10d %-5s\n\n",step,mod,good);
break;
}
else if(seed == 0)
{
printf("%10d%10d %-5s\n\n",step,mod,bad);
break;
}
}
}
return 0;
}
浙公网安备 33010602011771号