|
|
вернуться в форумПоказать все сообщения Спрятать все сообщения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. >Tmp := Sqrt(Sqr(R) - Sqr(I)); Overflow of longint type for r>32768. And according to the statement r<=100000. Дело не в этом longint ограничен 2^31-1>2000000000 а вот inc не работает с типом int64 |
|
|