传送门:https://www.nowcoder.com/acm/contest/96/C

参考:http://www.cnblogs.com/Dillonh/p/8835074.html

题意:

durong有a台iphonex和b台s8,并且放在一个保险箱里,durong现在一台一台从保险箱随机拿出这些手机,现在他想知道第k次拿出s8的概率是多少。

思路:

这道题的数学推到真的是惊奇呀。

牛客-长沙理工校赛C-取手机

 

由此就可以发现结果和K无关,只与a,b有关;

#include <cstdio>
using namespace std;

typedef long long ll;

int main(){
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,b,k;
        scanf("%d%d%d",&a,&b,&k);
        ll tmp = a+b;
        double ans = b*1.0/tmp;
        printf("%.3f\n",ans);  
    }
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2022-02-21
  • 2021-07-17
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
猜你喜欢
  • 2021-11-11
  • 2021-11-11
  • 2022-12-23
  • 2021-08-29
  • 2021-12-08
  • 2021-11-15
相关资源
相似解决方案