|
|
back to boardwhat is wrong with my program? I cannot pass test10 and i cannot find any mistakes. I cannot pass test10 and i cannot find any mistakes. Is my algo wrong? my code: program p1490; var r,n:int64; i:longint; x:real; begin readln(r); for i:=r-1 downto 0 do begin x:=sqrt(sqr(r)-sqr(i)); if x-trunc(x)<1e-10 then inc(n,r-trunc(x)) else inc(n,r-trunc(x)-1); end; writeln(4*(r*r-n)); end. Re: what is wrong with my program? I cannot pass test10 and i cannot find any mistakes. I have got AC! I changed "sqr(r)-sqr(i)" into "(r+i)*(r-i)". Then I don't WA#10 any more, but I don't know why. Could anyone tell me? Sorry for my poor English... Re: what is wrong with my program? I cannot pass test10 and i cannot find any mistakes. Overflow of type. Edited by author 30.07.2012 20:16 Edited by author 30.07.2012 20:17 |
|
|