|
|
вернуться в форумWrong answer ? :( why ? pls. check my program var n,p:longint; begin read(n); for p:=round(sqrt(n))+1 downto 1 do if (((n-(p*(p-1) div 2))/p=trunc ((n-(p*(p-1) div 2))/p)) and ((n-(p*(p-1) div 2))/p>0)) then begin writeln(((n-(p*(p-1) div 2))/p):0:0,' ',p); halt; end; end. Re: Wrong answer ? :( why ? pls. check my program > var n,p:longint; > begin > read(n); > for p:=round(sqrt(n))+1 downto 1 do if (((n-(p*(p-1) div 2))/p=trunc > ((n-(p*(p-1) div 2))/p)) and > ((n-(p*(p-1) div 2))/p>0)) > then begin > writeln(((n-(p*(p-1) div 2))/p):0:0,' ',p); > halt; > end; > end. P is a lot Bigger; |
|
|