|
|
back to boardCrash On #10 Posted by CHN_XT 14 Oct 2006 18:11 Help me! Program Contest_B; Var I, R : LongInt; Ans : Int64; Tmp : Extended; Begin ReadLn(R); If R = 1 Then Ans := 4 Else Begin Ans := 0; For I := R - 1 Downto 0 Do Begin Tmp := Sqrt(Sqr(R) - Sqr(I)); If Tmp - Trunc(Tmp) <= 1E-9 Then Inc(Ans, Trunc(Tmp)) Else Inc(Ans, Trunc(Tmp) + 1); End; Ans := Ans * 4; End; WriteLn(Ans); End. Re: Crash On #10 >Tmp := Sqrt(Sqr(R) - Sqr(I)); Overflow of longint type for r>32768. And according to the statement r<=100000. Re: Crash On #10 Дело не в этом longint ограничен 2^31-1>2000000000 а вот inc не работает с типом int64 |
|
|