Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Josephus-problem/IS-BASIC/josephus-problem.basic
Normal file
14
Task/Josephus-problem/IS-BASIC/josephus-problem.basic
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
100 PROGRAM "Josephus.bas"
|
||||
110 INPUT PROMPT "Number of prisoners: ":NP
|
||||
120 INPUT PROMPT "Execution step: ":EX
|
||||
130 INPUT PROMPT "How many survivors: ":SU
|
||||
140 PRINT "Survivors:";
|
||||
150 FOR S=0 TO SU-1
|
||||
160 PRINT JOSEPHUS(NP,EX,S);
|
||||
170 NEXT
|
||||
180 DEF JOSEPHUS(N,K,M)
|
||||
190 FOR I=M+1 TO N
|
||||
200 LET M=MOD((M+K),I)
|
||||
210 NEXT
|
||||
220 LET JOSEPHUS=M
|
||||
230 END DEF
|
||||
Loading…
Add table
Add a link
Reference in a new issue