题目连接:uva 10056 - What is the Probability ? 题目大意:给出n和p以及m,表示有n个人在丢色子, 谁先丢到某个值就表示胜利,每个人丢到的胜利数值的概率都为p,问第m个人获胜概率. 解题思路:因为n个人可以轮流丢色子,所以要自己定一个下限,而且以为人数比较多,每次并不需要将m以外的人都考虑进去,可以默认为没有丢到胜利的数值. #include <stdio.h> const double tmp = 1e-7; int main () { int cas,…
10491 - Cows and Cars Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1432 In television contests, participants are often asked to choose one from a set…
题目连接:uva 11722 - Joining with Friend 题目大意:你和朋友乘火车,而且都会路过A市.给定两人可能到达A市的时段,火车会停w.问说两人能够见面的概率. 解题思路:y = x + w 和y = x - w在给定时间内围成的面积除以时间的总面积,就是求面积的时候要分情况处理. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int t…