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 1369. Cockroach Race

Precision
Posted by lxn 31 May 2016 18:16
I have figured out that the 6th test contains numbers with 8 digits after the decimal point. Is it the maximum alowed or are there tests with more than 8 digits after decimal point. What tollerance shouled be used to compare distances between points? It it neccessary to do it with no error or is there an accepted tollerane?

I have generated several test cases with only 6 digits after decimal point, and doubles doesn't allow to resolve this tests correctly. If there are 8 digits after decimal point and 4 before, it is necessary to store about 24 digits.

1) is is necessary to compare distances between points with no error?
2) What is maximum alowed number of digits after decimal point in input?

test cases:
2
999.969732 999.984915
1414.181493 0
1
0 0
>>>>>
(999.969732 * 999.969732 + 999.984915 * 999.984915 == 1414.181493 * 1414.181493 == 1999909.295143709049)

2
999.856428 999.897768
1414.039753 0
1
0 0
>>>>>
(999.856428 * 999.856428 + 999.897768 * 999.897768 == 1999508.423064301008 < (1414.039753 * 1414.039753 == 1999508.423064301009))

2
999.725264 999.971561
1413.999196 0
1
0 0
>>>>>
(999.725264 * 999.725264 + 999.971561 * 999.971561 == 1999393.726288646417 > (1413.999196 * 1413.999196 == 1999393.726288646416))

Edited by author 31.05.2016 18:21