Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
20
Task/Josephus-problem/OxygenBasic/josephus-problem.basic
Normal file
20
Task/Josephus-problem/OxygenBasic/josephus-problem.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
uses console
|
||||
|
||||
int n, k
|
||||
n = 41 'prisoners
|
||||
k = 3 'order of execution
|
||||
|
||||
function Josephus(n as int, k as int, m as int) as int
|
||||
int lm, i
|
||||
|
||||
lm = m
|
||||
for i = m + 1 to n
|
||||
lm = (lm + k) mod i
|
||||
next
|
||||
return lm
|
||||
end function
|
||||
|
||||
printl "n = " n chr(9) "k = " k chr(9) "final survivor = " Josephus(n, k, 0)
|
||||
|
||||
printl cr "Enter ..."
|
||||
waitkey
|
||||
Loading…
Add table
Add a link
Reference in a new issue