Recent

Author Topic: Monkeys and coconuts: a challenge  (Read 9305 times)

marcio2003

  • Jr. Member
  • **
  • Posts: 69
Re: Monkeys and coconuts: a challenge
« Reply #15 on: May 01, 2015, 06:27:24 pm »
I am sorry for my previous posted code.
The solution is more simple than everything.
Have n solutions to solve easy way with:
Part_Per_Sailors( n ) = 1204 * n - 820
Amount_ Initial( n ) = 15625 * n - 12504
Is it the ultimate?
What's the next steep?
Code: [Select]
procedure TForm1.B1Click(Sender: TObject);
var
  n: integer;
begin
  StringGrid1.Cells[ 0, 0 ]:= 'Solution';
  StringGrid1.Cells[ 1, 0 ]:= 'AmountInitial';
  StringGrid1.Cells[ 2, 0 ]:= 'FinalQuote/Sailors';
  StringGrid1.AutoAdjustColumns;
  for n:= 1 to 10 do { Ten initial solutions }
  begin
    StringGrid1.Cells[ 0, n ]:= IntToStr( n );
    StringGrid1.Cells[ 1, n ]:= IntToStr( 15625 * n - 12504 );
    StringGrid1.Cells[ 2, n ]:= IntToStr( 1024 * n - 820 );
  end;
end;
Lazarus 2.0.10 Windows 10 64bits

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek

marcio2003

  • Jr. Member
  • **
  • Posts: 69
Re: Monkeys and coconuts: a challenge
« Reply #17 on: May 01, 2015, 06:32:21 pm »
I am sorry one more time:
Part_Per_Sailors( n ) = 1024 * n - 820
Lazarus 2.0.10 Windows 10 64bits

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Re: Monkeys and coconuts: a challenge
« Reply #18 on: May 02, 2015, 06:03:50 am »
Finally Q2:

Q = 15625*Ni + 3121; where Ni=0,1,2,3...
and
Q = 15625*Ni + 6246; for Q5

Got this by demanding 8 times both sides of the equation be even, i.e. N=2N`+1
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

 

TinyPortal © 2005-2018