ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1120. Sum of Sequential Numbers

Help me, please? Why time limit exceeded 9?
Posted by AlexeyPechenin 25 Nov 2007 23:35
var
 k,n,m: Real;
 koren, p: Real;
 ok: Boolean;
begin
 Readln(n);
 k:=0;
 p:=0;
 repeat
 ok:=false;
 m:=n+p;
 koren := (-1+sqrt(1+8*m))/2;
 if frac(koren) < 1e-18 then
  begin
   writeln(round(k+1),' ',round(koren - k));
   ok:=true;
  end
 else
  begin
   k := k + 1;
   p:= (sqr(k) + k)/2;
  end;
 Until ok;
End.
Re: Help me, please? Why time limit exceeded 9?
Posted by Madhav 13 Jun 2008 01:34
i am also getting time limit exceeded for test 9