蓝桥杯-算法提高 概率计算

问题描述

  生成n个∈[a,b]的随机整数,输出它们的和为x的概率。
输入格式
  一行输入四个整数依次为n,a,b,x,用空格分隔。
输出格式
  输出一行包含一个小数位和为x的概率,小数点后保留四位小数
样例输入
2 1 3 4
样例输出
0.3333
数据规模和约定
  对于50%的数据,n≤5.
对于100%的数据,n≤100,b≤100.

参考代码

此处为隐藏的内容!
发表评论并刷新,才能查看

俊霖

发表评论

您必须

目前评论:5   其中:访客  4   博主  1


    Warning: A non-numeric value encountered in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/comment-template.php on line 20
  1. 王玲玉 5

    Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/default.php on line 566
  2. 5

    Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/default.php on line 566
  3. ymx200181 5

    Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/default.php on line 566
  4. 梦醒 4

    Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/default.php on line 566
    • 俊霖 俊霖

      Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /www/wwwroot/jurieo.com/wp-content/themes/begin2.0/inc/function/default.php on line 566

      @梦醒