10491专题

uva 10491 - Cows and Cars(概率)

题目连接:uva 10491 - Cows and Cars 题目大意:给出a,b和c,表示有a + b 个门, a个后面是牛, b个后面是车, 然后你从中选一个门,之后有一个知情人帮你打开c个后面是牛的门(因为1≤c< a,所以就算第一次选中牛,知情人还是可以打开c个门),然后你在没有打开的门中选一个,问说第二次选得门后面是车的概率。 解题思路:问题可以分成两种情况: 1)第一

uva 10491 Cows and Cars

原题: In television contests, participants are often asked to choose one from a set of or doors for example, one or several of which lead to different prizes. In this problem we will deal with a speci

uva 10491 概率

#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){double a, b, c;while (cin >> a >> b >> c)printf("%.5f\n", b * (a + b - 1) / (a + b) / (a + b - c - 1));return 0;}