Dim As Integer cocos = 11 For ns As Integer = 2 To 9 Dim As Integer oculta(ns) cocos = Int(cocos / ns) * ns + 1 Do Dim As Integer nc = cocos For s As Integer = 1 To ns+1 If nc Mod ns = 1 Then oculta(s-1) = Int(nc / ns) nc = nc - (oculta(s-1) + 1) If s = ns And Not (nc Mod ns) Then Print ns; " marineros requieren un m¡nimo de"; cocos; " cocos" For t As Integer = 1 To ns Print !"\tEl marinero"; t; " se esconde"; oculta(t - 1) Next t Print !"\tEl mono obtiene"; ns Print !"\tFinalmente, cada marinero se lleva"; Int(nc / ns); !"\n" Exit Do End If Else Exit For End If Next s cocos += ns Loop Next ns Sleep