数学方法:

  • 从每个箱子来考虑:m次选择以后,至少有一次被选中的概率为SGU 495 Kids and Prizes.因为这些箱子是相互独立的,所以被选中的箱子数的期望为SGU 495 Kids and Prizes
 1 #include <iostream>
 2 #include <cmath>
 3 #include <cstdio>
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int n, m;
 9     while(scanf("%d%d", &n, &m) == 2)
10     {
11         double ans = n * 1.0 * (1.0 - pow((1.0 - (1.0 / n)), m));
12         printf("%.12f\n", ans);
13     }
14 
15     return 0;
16 }
代码君

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-08-01
  • 2022-12-23
  • 2022-01-15
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案