Help needed in atcoder dp contest in I Problem (Coins)

my submission link
there are too many wa’s.
What have i done
i make 2d dp array in which dp[i][j] denote if i start at index i and I need to have atleast k
heads 's answer
and i write some recurisive function with base cases
first case if the remaining elements are less than required heads i will simply return 0
second case if i have traversed all array then returning 1 means nothing can be done
and main logic
dp[i][j] = head*(index+1,count-1) + tails(index+1,count)
head is probability of heads coming same with tails and count denote how much required

UPD:: I solved it using itereative method still looking for mistake in recursive version and i made a change in value of k = (n/2) + 1 i was missing for even sized array