28 lines
728 B
Text
28 lines
728 B
Text
cocos = 11
|
|
|
|
for marineros = 2 to 9
|
|
dim oculta(marineros)
|
|
cocos = int(cocos / marineros) * marineros + 1
|
|
while true
|
|
nc = cocos
|
|
for s = 1 to marineros + 1
|
|
if nc mod marineros = 1 then
|
|
oculta[s-1] = int(nc / marineros)
|
|
nc -= oculta[s-1] + 1
|
|
if (s = marineros) and (nc mod marineros = 0) then
|
|
print marineros; " sailors require a minimum of "; cocos; " cocos"
|
|
for t = 1 to marineros
|
|
print chr(9); "Sailor "; t; " hides "; oculta[t - 1]
|
|
next t
|
|
print chr(9); "The monkey gets "; marineros
|
|
print chr(9); "Finally, each sailor takes "; int(nc / marineros); chr(10)
|
|
exit while
|
|
end if
|
|
else
|
|
exit for
|
|
end if
|
|
next s
|
|
cocos += marineros
|
|
end while
|
|
next marineros
|
|
end
|