Блог пользователя ramanujanankur

Автор ramanujanankur, история, 8 лет назад, По-английски

I submitted code for the problem problem D. My incorrect submission is Incorrect while accepted solution is Accepted. As you can see that i changed from calculating the whole area and then remove sector area to simply adding areas of segments.But why should precision differ so much? I could not find the reason for this.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Let's say you want to calculate x - y where x = 25000 and y = 24997. The answer should be 3. But it turns out that you first calculated x with precision error 10 - 4 and you got x = 24997.5. You would now print x - y = 0.5, instead of 3.

Apparently, you encountered something similar there. It isn't good to calculate something with/on big numbers and then subtract them, because smaller precision error may change to very big one.