fork download
  1.  
  2. function words(w1, w2, day: integer): integer;
  3. var
  4. today: integer;
  5. begin
  6. today := (w1 + w2) div 2 + 2;
  7. if (50 <= today) then
  8. words := day
  9. else
  10. words := words(w2, today, day + 1);
  11. end;
  12.  
  13. begin
  14. writeLn('Незнайко продержался ', words(1, 1, 3), ' дней.');
  15. end.
Success #stdin #stdout 0.01s 4112KB
stdin
Standard input is empty
stdout
Незнайко продержался 50 дней.