[mine248]

The probability of two coins face up respectively p and q, each toss of a coin thrown back take a step up, thrown up front, repeat this step instead take a step to the right; the second toss coins thrown into the front probability go down further, take a step to the left thrown back, seeking after the starting point
 
After polishing the first set up an x, right y, the probability of one is $ p ^ {2} \ cdot (1-p) ^ {x + y} $, $ second gold is the probability C ( x + y, x) \ cdot q ^ {x} \ cdot (1-q) ^ {y} $, i.e. the total probability
  $ p ^ {2} \ sum_ {x} \ sum_ {y} (1-p ) ^ {X + Y} \ CDOT C (X + Y, X) \ CDOT Q ^ {X} \ CDOT (. 1-Q) ^ {Y} $
$ = P ^ {2} \ sum_ {Z = X + Y} (. 1-P) ^ {Z} \ sum_ {X} C (Z, X) \ CDOT Q ^ {X} \ CDOT (. 1-Q) ^ {ZX} $
$ = P ^ {2} \ sum_ {z = x + y} ( 1-p) ^ {z} \ cdot (1-q) ^ {z} \ sum_ {x} (q / (1-q)) ^ x \ cdot c (z, x ) $
$ P = 2 ^ {} \ sum_ {} Z = X + Y (. 1-P) ^ $ {Z} = P
1 #include<bits/stdc++.h>
2 using namespace std;
3 double p,q;
4 int main(){
5     scanf("%lf%lf",&p,&q);
6     printf("%.3f",p);
7 }
View Code

 

Guess you like

Origin www.cnblogs.com/PYWBKTDA/p/11286402.html