In today's kickstart problem, https://codejam.withgoogle.com/codejam/contest/6304486/dashboard#s=p1
I am getting wrong answer on big input but smaller input works fine and gives correct answer. Here is my code: https://ideone.com/7Ffer4
I tried with bigger input and answer is coming mostly as 0.
I can't find the error. Can someone tell the error and how to correct it.
I think it will lead to overflow in dp array.
No I checked with
N = 2000
M = 1999
There was no overflow in dp though answer was very large in 10^18.
there is overflow.If u are not convinced try running a loop over the dp array and check if anything is less than zero for testcase N=2000,M=1999
The answer is (n-m)/(n+m)