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 1490. Fire Circle

what is wrong with my program? I cannot pass test10 and i cannot find any mistakes.
Posted by williamljb 2 Aug 2009 14:17
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.
Posted by williamljb 2 Aug 2009 18:28
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.
Posted by Taras Vasylyshyn 30 Jul 2012 20:15
Overflow of type.

Edited by author 30.07.2012 20:16

Edited by author 30.07.2012 20:17