Purple book code is strong invincible.
#include
# define maxn 25
Int n, k, m, a, [maxn].
Int the go (int p, int d, int t) {
While (t -) {
Do {
P=(p + d + n - 1) % n + 1;//this step is the core of this cover what the step is strong here n cannot be omitted because d may also be negative (against several)
[p]} while (a==0).
}
Return the p;
}
Int main () {
While (the scanf (" % d % d % d ", & amp; N, & amp; K, & amp; M)==3 & amp; & N) {
for(int i=1; i<=n; I++) {
A [I]=I;
}
Int left=n;
Int p1=n, p2=1;
While (left) {//someone retained
P1=go (p1, 1, k);
The p2=go (p2, 1, m);//number one count
Printf (" % 3 d ", (p1);
The left -;
If (p2!={p1)
Printf (" % 3 d ", p2);
The left -;
}
A (p1)=a (p2)=0;
If (left) printf (", ");
}
printf("\n");
}
}