Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,37 @@
|
|||
// Dinesmans multiple-dwelling problem
|
||||
//https://rosettacode.org/wiki/Dinesman%27s_multiple-dwelling_problem
|
||||
|
||||
|
||||
short Baker,Cooper,Fletcher,Miller,Smith
|
||||
short LoopCount
|
||||
|
||||
FOR Baker = 0 TO 4
|
||||
FOR Cooper = 0 TO 4
|
||||
FOR Fletcher = 0 TO 4
|
||||
FOR Miller = 0 TO 4
|
||||
FOR Smith = 0 TO 4
|
||||
IF Baker <> 4 && Cooper <> 0 && Miller <> Cooper
|
||||
IF Fletcher <> 0 && Fletcher <> 4 && ABS(Smith-Fletcher)<>1 && ABS(Fletcher-Cooper)<>1
|
||||
IF Baker<>Cooper and Baker<>Fletcher && Baker<>Miller and ¬
|
||||
Baker<>Smith and Cooper<>Fletcher and Cooper<>Miller and ¬
|
||||
Cooper<>Smith and Fletcher<>Miller and Fletcher<>Smith and ¬
|
||||
Miller<>Smith
|
||||
|
||||
LoopCount ++
|
||||
if LoopCount = 4
|
||||
PRINT "Baker lives on floor " ; Baker + 1
|
||||
PRINT "Cooper lives on floor " ; Cooper + 1
|
||||
PRINT "Fletcher lives on floor " ; Fletcher + 1
|
||||
PRINT "Miller lives on floor " ; Miller + 1
|
||||
PRINT "Smith lives on floor " ; Smith + 1
|
||||
end if
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
NEXT Smith
|
||||
NEXT Miller
|
||||
NEXT Fletcher
|
||||
NEXT Cooper
|
||||
NEXT Baker
|
||||
|
||||
handleevents
|
||||
Loading…
Add table
Add a link
Reference in a new issue