9 lines
219 B
Text
9 lines
219 B
Text
fcn j(n,k){
|
|
reg p=[0..n-1].walk().copy(), i=0, seq=L();
|
|
while(p){
|
|
i=(i+k-1)%p.len();
|
|
seq.append(p.pop(i));
|
|
}
|
|
"Prisoner killing order: %s.\nSurvivor: %d"
|
|
.fmt(seq[0,-1].concat(","),seq[-1]);
|
|
}
|