输入a,b,c, a牛,b车,知情人会一次性打开c个门(注意是一次性全部打开c个门,要是一次打开一个的那完全不同了,另外还注意一点,如果你选的就是牛,虽然知情人能打开c个门,但是它不能打开你那个,而题目有一个条件 0<=c<a , 这说明即便你选了一个牛,知情人还是能打开c个门的,是另外的c个门)
1.第一次选择牛,概率为a/(a+b),然后知情人打开了c个门(自己选的那个不被打开),然后现在实际上只剩下a+b-c个门(包括自己选的那个)。改变选择,那么现在能选的门的个数为a+b-c-1,选到车的概率为b/(a+b-c-1)。由于是条件概率所以要相乘 p1=a/(a+b) * b/(a+b-c-1)
2.如果第一次选到车,概率为b/(a+b),然后知情人打开c个门,实际上剩下的门也是a+b-c。改变选择,那么能选的个数为a+b-c-1,车的个数只剩下b-1(你放弃了之前选择的那个),选到车的概率就是 (b-1)/(a+b-c-1) , 两者相乘 p2=b/(a+b) * (b-1)/(a+b-c-1)
3. ans=p1+p2
/***********************************************
* Author: fisty
* Created Time: 2015/3/3 16:02:30
* File Name : uva10491.cpp
*********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout << #x << " " << x <<endl
#define Memset(x, a) memset(x, a, sizeof(x))
const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> P;
#define FOR(i, a, b) for(int i = a;i < b; i++)
int main() {
//freopen("in.cpp", "r", stdin);
int a, b, c;
while(~scanf("%d%d%d", &a, &b, &c)){
double p1 = 1.*a*b/((a+b)*(a+b-c-1));
double p2 = 1.*b*(b-1)/((a+b)*(a+b-c-1));
printf("%.5f\n",p1 + p2);
}
return 0;
}