fork download
  1. program pyramid;
  2.  
  3. var
  4. L, N,area, lato : LongInt;
  5.  
  6. begin
  7. {
  8.   uncomment the two following lines if you want to read/write from files
  9.   assign(input, 'input.txt'); reset(input);
  10.   assign(output, 'output.txt'); rewrite(output);
  11. }
  12.  
  13. ReadLn(N);
  14. L := 0; area:=0;
  15. while area<=N do
  16. begin
  17. L:=L+1;
  18. area:=area+L*L;
  19. if area>N then continue;
  20. end;
  21. WriteLn(L-1);
  22.  
  23. end.
Success #stdin #stdout 0s 5288KB
stdin
9
stdout
2