eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Трудный путь

опубликовано 29.05.2022, 13:55:17

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