FUNPROB - Yanu in Movie theatre
Yanu is a great fan of Harry Potter. So on the day of the movie release, Yanu rushes to the movie theatre to watch the movie. On the release of the 6th movie, on reaching the theatre she found a long queue for tickets already. As the distribution was about to start, the ticket counter did not have any change to start with. There are N+M people in queue, where N have Rs 10.00 and M have Rs 5.00. The ticket costs Rs 5.00.
Now Yanu is math geek too, now she wonders What is the probability that the theatre can always provide change.
Each line contain N and M, separated by a space, End of Input is marked by 0 0 which should not be processed. Both N and M fits in integer range.
For each input, output the respective probability up to 6 decimal digits.
is this probem can be solved by catalan number concept?
the solution to the problem: https://en.wikipedia.org/wiki/Bertrand%27s_ballot_theorem
how is this easy ? i could'nt come up with the formula :(
So easy just observe the pattern
if anyone solved it using formula. can you please post in detail, how you arrived at the formula?
damn i suck at math :(
it was n easy problem.... :)
Use printf("%lf",ans) for ordering. Got WA without it.
my 50th!!! Easy!
my 50th..ac in 1 go...<3