Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Josephus-problem/Ring/josephus-problem.ring
Normal file
11
Task/Josephus-problem/Ring/josephus-problem.ring
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
n = 41
|
||||
k=3
|
||||
see "n =" + n + " k = " + k + " final survivor = " + josephus(n, k, 0) + nl
|
||||
|
||||
func josephus (n, k, m)
|
||||
lm = m
|
||||
for a = m+1 to n
|
||||
lm = (lm+k) % a
|
||||
next
|
||||
josephus = lm
|
||||
return josephus
|
||||
Loading…
Add table
Add a link
Reference in a new issue