Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Josephus-problem/Oforth/josephus-problem.fth
Normal file
12
Task/Josephus-problem/Oforth/josephus-problem.fth
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
: josephus(n, k)
|
||||
| prisoners killed i |
|
||||
n seq asListBuffer ->prisoners
|
||||
ListBuffer newSize(n) ->killed
|
||||
|
||||
0 n 1- loop: i [
|
||||
k 1- + prisoners size mod dup 1+ prisoners removeAt
|
||||
killed add
|
||||
] drop
|
||||
|
||||
System.Out "Killed : " << killed << "\nSurvivor : " << prisoners << cr
|
||||
;
|
||||
Loading…
Add table
Add a link
Reference in a new issue