ramanujanankur's blog

By ramanujanankur, history, 8 years ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.