I have found this problem at the Gym:
Two counterfeiters each made a coin: one of these coins has the probability of getting heads p%, and another one q%. For some reason the counterfeiters bet that if one chooses the random of these two coins, he gets heads two times in a row. They do so: choose the random coin and throw it. At the 1rst throw they really got heads. Now they want to know: what is the probability to getting heads at the second throw of the chosen coin?
Sample Test:
Input: 50 50 Output: 0.500000000000000
Input: 33 66 Output: 0.550000000000000
Input: 80 40 Output: 0.666666666666667
Does anyone could help me with this problem??
How can I find solutions ans codes for problems from the gym????
Full text and comments »