Some weird java floating point precision error

I had submitted this too, but it failed

Case #1: 33.333336 66.66667

Case #2: 0.0 100.0

Case #3: 25.0 25.0 25.0 25.0

Case #4: 34.666668 26.666668 38.666668

Case #5: 23.221476 23.221476 6.4429536 23.892616 23.221476

Case #6: 38.571426 61.42857

Case #7: 19.335794 13.062732 19.335794 27.82288 20.442806

Case #8: 0.0 14.285715 14.285715 14.285715 14.285715 14.285715 14.285715
14.285715

Case #9: 0.32467532 0.0 0.32467532 24.675323 25.0 24.675323 25.0

Case #10: 50.0 50.0

Case #11: 66.66667 33.333336

Case #12: 11.145648 13.277088 16.119007 13.809946 10.612789 9.19183
15.0532875 10.790408

Case #13: 9.999999 9.999999 9.999999 9.999999 9.999999 9.999999 9.999999
9.999999 9.999999 9.999999

Case #14: 25.093634 24.7191 0.0 24.7191 0.0 25.093634 0.37453184

Case #15: 100.0 0.0

Case #16: 14.018692 14.018692 13.551402 13.785047 1.635514 14.018692
13.785047 15.186914

Case #17: 16.666668 16.666668 16.666668 16.666668 16.666668 0.0 16.666668

Case #18: 83.561646 16.438356

Case #19: 16.114649 24.713377 25.35032 18.662422 15.159234

Case #20: 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5

On Sun, May 6, 2012 at 12:46 AM, Tushar Bindal <[email protected]>wrote:

> i had set precision to 6 decimal places and fixed it
> probably they wanted atleast one decimal point for integral solutions as
> they have done in the 3rd sample test case
> that is why your answer would be incorrect
>
>
> On Sun, May 6, 2012 at 12:45 AM, Tushar Bindal <[email protected]>wrote:
>
>> Case #1: 33.333334 66.666667
>> Case #2: 0.000000 100.000000
>> Case #3: 25.000000 25.000000 25.000000 25.000000
>> Case #4: 34.666667 26.666667 38.666667
>> Case #5: 23.221477 23.221477 6.442954 23.892618 23.221477
>> Case #6: 38.571429 61.428571
>> Case #7: 19.335794 13.062731 19.335794 27.822879 20.442805
>> Case #8: 0.000000 14.285715 14.285715 14.285715 14.285715 14.285715
>> 14.285715 14.285715
>> Case #9: 0.000000 0.000000 0.000000 24.783550 25.216451 24.783550
>> 25.216451
>> Case #10: 50.000000 50.000000
>> Case #11: 66.666667 33.333334
>> Case #12: 11.145648 13.277087 16.119006 13.809947 10.612789 9.191830
>> 15.053286 10.790409
>> Case #13: 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
>> 10.000000 10.000000 10.000000 10.000000
>> Case #14: 25.247525 24.752475 0.000000 24.752475 0.000000 25.247525
>> 0.000000
>> Case #15: 100.000000 0.000000
>> Case #16: 14.018692 14.018692 13.551402 13.785047 1.635514 14.018692
>> 13.785047 15.186916
>> Case #17: 16.666667 16.666667 16.666667 16.666667 16.666667 0.000000
>> 16.666667
>> Case #18: 83.561644 16.438357
>> Case #19: 16.114650 24.713376 25.350319 18.662421 15.159236
>> Case #20: 12.500000 12.500000 12.500000 12.500000 12.500000 12.500000
>> 12.500000 12.500000
>>
>>
>> This is what I got on my code which was accepted
>>
>>
>> On Sun, May 6, 2012 at 12:29 AM, tutufan <[email protected]> wrote:
>>
>>> Looking at your answer to Case #13, I don't see what's wrong.  Isn't
>>> this trivial in the same way as Case #20 or #4?
>>>
>>> (I failed this one myself.  Argh.)
>>>
>>>
>>>
>>> On Saturday, May 5, 2012 1:35:33 PM UTC-5, sk wrote:
>>>
>>>> Appologes , Its wrong, didn't see output of Testcase 13
>>>>
>>>> On Sun, May 6, 2012 at 12:04 AM, sumit sharma 
>>>> <sksumit1@<[email protected]>
>>>> xxx> wrote:
>>>>
>>>>> For question Round1B Problem A
>>>>>
>>>>> Question :
>>>>>
>>>>> 20
>>>>>
>>>>> 2 20 10
>>>>>
>>>>> 2 10 0
>>>>>
>>>>> 4 25 25 25 25
>>>>>
>>>>> 3 24 30 21
>>>>>
>>>>> 5 50 50 100 48 50
>>>>>
>>>>> 2 86 54
>>>>>
>>>>> 5 56 73 56 33 53
>>>>>
>>>>> 8 77 0 0 0 0 0 0 0
>>>>>
>>>>> 7 76 77 76 1 0 1 0
>>>>>
>>>>> 2 93 93
>>>>>
>>>>> 2 1 2
>>>>>
>>>>> 8 78 66 50 63 81 89 56 80
>>>>>
>>>>> 10 100 100 100 100 100 100 100 100 100 100
>>>>>
>>>>> 7 0 1 67 1 67 0 66
>>>>>
>>>>> 2 0 61
>>>>>
>>>>> 8 47 47 49 48 100 47 48 42
>>>>>
>>>>> 7 0 0 0 0 0 68 0
>>>>>
>>>>> 2 12 61
>>>>>
>>>>> 5 75 48 46 67 78
>>>>>
>>>>> 8 21 21 21 21 21 21 21 21
>>>>>
>>>>>
>>>>>
>>>>> Answer :
>>>>>
>>>>>
>>>>> Case #1: 33.33334 66.66667
>>>>>
>>>>> Case #2: 0 100
>>>>>
>>>>> Case #3: 25 25 25 25
>>>>>
>>>>> Case #4: 34.66667 26.66667 38.66667
>>>>>
>>>>> Case #5: 23.22148 23.22148 6.44295 23.89262 23.22148
>>>>>
>>>>> Case #6: 38.57143 61.42857
>>>>>
>>>>> Case #7: 19.33579 13.06273 19.33579 27.82288 20.44281
>>>>>
>>>>> Case #8: 0 14.28572 14.28572 14.28572 14.28572 14.28572 14.28572
>>>>> 14.28572
>>>>>
>>>>> Case #9: 0.32468 0 0.32468 24.67532 25 24.67532 25
>>>>>
>>>>> Case #10: 50 50
>>>>>
>>>>> Case #11: 66.66667 33.33334
>>>>>
>>>>> Case #12: 11.14565 13.27709 16.11901 13.80995 10.61279 9.19183
>>>>> 15.05329 10.79041
>>>>>
>>>>> Case #13: 10 10 10 10 10 10 10 10 10 10
>>>>>
>>>>> Case #14: 25.09363 24.7191 0 24.7191 0 25.09363 0.37453
>>>>>
>>>>> Case #15: 100 0
>>>>>
>>>>> Case #16: 14.01869 14.01869 13.5514 13.78505 1.63551 14.01869 13.78505
>>>>> 15.18691
>>>>>
>>>>> Case #17: 16.66667 16.66667 16.66667 16.66667 16.66667 0 16.66667
>>>>>
>>>>> Case #18: 83.56165 16.43836
>>>>>
>>>>> Case #19: 16.11465 24.71338 25.35032 18.66242 15.15923
>>>>>
>>>>> Case #20: 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5
>>>>>
>>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/google-code/-/tY9xQY26z4gJ.
>>>
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>>
>>
>> --
>> Tushar Bindal
>> Computer Engineering
>> Delhi College of Engineering
>> Mob: +919818442705
>> E-Mail : [email protected]
>>
>>
>
>
> --
> Tushar Bindal
> Computer Engineering
> Delhi College of Engineering
> Mob: +919818442705
> E-Mail : [email protected]
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to