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

what is wrong!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! help me!!
Posted by matkir_ssau 4 Jan 2006 01:50
test #9 help,help please
anybody please give me test #9
{================================}

var q1,q,k,p,y,z:real;
n,i:longint;
begin
read(n);
q:=0;
q1:=0;

for i:=round(sqrt(n)*1.2353) downto 1 do
begin
y:=n/i; k:=n/(i+0.5);
 if (frac(y)=0) and (frac(y/2-0.5)=0) and   ((n/y+0.5-y/2)>0) then if q<y then  q:=y;
 if (frac(k)=0) and (frac(k/2)=0)  and  ((n/k+0.5-k/2)>0) then   if q1<k then  q1:=k;
end;

if (q>q1)  then  if (q*q+(2*(n/q+0.5-q/2)-1)*q=2*n) then begin writeln((n/q+0.5-q/2):0:0,' ',q:0:0);z:=1;end;
if (q<q1)  then if (q1*q1+(2*(n/q1+0.5-q1/2)-1)*q1=2*n) then begin writeln((n/q1+0.5-q1/2):0:0,' ',q1:0:0);z:=1;end;
if z<>1 then writeln(n,' ',1);
end.

Edited by author 04.01.2006 17:30