Problem link–https://www.codechef.com/IPC15BMR/problems/CANGAME/

My solution–

SOUT(MATH.MAX(N,M)+"."+“000000”);

How answer is (n*m)??

Thanks in Advance

This falls under a class of problem’s called Gambler’s ruin, look for absorption time in this document on page 9 (http://www2.math.uu.se/~sea/kurser/stokprocmn1/slumpvandring_eng.pdf . When the flip has equal probabilities then E[X](where X is expected number of games till game finish) is M*N.

I tried to open the link,its say Error 404 not found

@vivek96 in the url delete ). at end

Or use this

http://www2.math.uu.se/~sea/kurser/stokprocmn1/slumpvandring_eng.pdf

5 Likes

The logic of the question is not clear …I need to read above link

1 Like