题目链接: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 }

 

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

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

相关文章:

  • 2021-11-29
  • 2021-08-08
  • 2021-10-25
  • 2021-12-13
  • 2022-01-04
  • 2022-01-12
  • 2022-01-25
  • 2021-12-08
猜你喜欢
  • 2021-11-05
  • 2021-09-12
  • 2021-08-15
  • 2021-10-28
  • 2021-10-18
  • 2021-08-05
  • 2021-09-03
相关资源
相似解决方案