Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
13
Task/Josephus-problem/FutureBasic/josephus-problem.basic
Normal file
13
Task/Josephus-problem/FutureBasic/josephus-problem.basic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
local fn Josephus( n as int, k as int, m as int ) as int
|
||||
int lm = m
|
||||
for int i = m + 1 to n
|
||||
lm = (lm + k) % i
|
||||
next
|
||||
end fn = lm
|
||||
|
||||
int n : n = 41 // prisoners
|
||||
int k : k = 3 // order of execution
|
||||
|
||||
printf @"Prisoners: %d\nOrder of execution: %d\nFinal survivor: No. %d", n, k, fn Josephus( n, k, 0 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue