Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

How to determine if double would be precise enough?

$
0
0

I was trying to solve the problem FTRIP Field Trip. I came to the conclusion that I have to calculate some binomial coefficients C(n,k). But the ranges were high. At the worst case I have to calculate C(1000,500). This obviously will not fit 64 bit int. I could use doubles, but even that will not be precise enough ( or so I thought ). I tried thinking of other solutions that didn't involve binomial coefficient, but didn't find any. If only I could calculate C(n,k) with enough precision then problem would be solved.

Then I went to the editorial to see how they handled the situation. They used double. Now I am confused. How will I determine if the double would be precise enough to get me AC? Is it because this problem has special judge that using double leads to AC?


Viewing all articles
Browse latest Browse all 39796

Trending Articles