Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Josephus-problem/11l/josephus-problem.11l
Normal file
11
Task/Josephus-problem/11l/josephus-problem.11l
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
F j(n, k)
|
||||
V p = Array(0 .< n)
|
||||
V i = 0
|
||||
[Int] seq
|
||||
L !p.empty
|
||||
i = (i + k - 1) % p.len
|
||||
seq.append(p.pop(i))
|
||||
R "Prisoner killing order: #..\nSurvivor: #.".format(seq[0 .< (len)-1].join(‘, ’), seq.last)
|
||||
|
||||
print(j(5, 2))
|
||||
print(j(41, 3))
|
||||
Loading…
Add table
Add a link
Reference in a new issue