eolymp
bolt
Try our new interface for solving problems
Problems

Difficult path

published at 5/29/22, 1:55:17 pm

If n<m or n+m is odd, then it's clear that there is no way to reach home after n steps and hence the probability in those cases will be 0. Now, we have to take m steps more than the number of backward steps. Let the number of backward moves be x, then a number of forward moves will be x+m. (x+m) + x = n => x = (n-m)/2

So total number of ways to reach home = nCx The required answer will be nCx/2^n