Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Josephus-problem/QBasic/josephus-problem.basic
Normal file
12
Task/Josephus-problem/QBasic/josephus-problem.basic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
FUNCTION josephus (n, k, m)
|
||||
lm = m
|
||||
FOR i = m + 1 TO n
|
||||
lm = (lm + k) MOD i
|
||||
NEXT i
|
||||
josephus = lm
|
||||
END FUNCTION
|
||||
|
||||
n = 41
|
||||
k = 3
|
||||
PRINT "n = "; n, "k = "; k, "final survivor = "; josephus(n, k, 0)
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue