Codeforces Round #185 (Div. 2) B. Archer

题目链接:http://codeforces.com/problemset/problem/312/B

题目大意:

  很简短,不解释了。

题目思路:

  开始怎么也读不懂题意,以为求期望呢,想不开……后来问了别人才知道,原来就是求概率,也没说多少个回合,所以就是求极限……

  所以,这货就是一道很简洁的概率题,推个公式就好了。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstdlib>
 4 #include <cstring>
 5 #include <cmath>
 6 using namespace std;
 7 int main(void) {
 8   int a, b, c, d;
 9   double p1, p2, ans;
10   scanf("%d%d%d%d", &a, &b, &c, &d);
11   p1 = 1.0*a/b; p2 = 1.0*c/d;
12   ans = p1/(1-(1-p1)*(1-p2));
13   printf("%.12f\n", ans);
14   return 0;
15 }

开始为什么怎么也读不懂捏?果然是理解能力差么?

这题几天前做的,忘了总结一下了。

原文地址:https://www.cnblogs.com/liuxueyang/p/3110001.html