I am trying to solve 478B - Random Teams . And here is my submission 81868059 . Logic is good but still gives wrong answer in 12th test case. before 12th case there was large integer input but answer was good. I have failed to understand whats wrong with this. How should i fix this?
Avoid using doubles if they are not needed. Here you can do everything on long longs.
Do not use doubles if avoidable, they are error prone.