Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Josephus-problem/Chipmunk-Basic/josephus-problem.basic
Normal file
11
Task/Josephus-problem/Chipmunk-Basic/josephus-problem.basic
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
100 n = 41
|
||||
110 k = 3
|
||||
120 print "n = ";n,"k = ";k,"final survivor = ";josephus(n,k,0)
|
||||
130 end
|
||||
140 function josephus(n,k,m)
|
||||
150 lm = m
|
||||
160 for i = m+1 to n
|
||||
170 lm = (lm+k) mod i
|
||||
180 next
|
||||
190 josephus = lm
|
||||
200 end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue