[排列组合] 求概率问题,求大佬们指教

2019-04-18 23:33:02 +08:00
 fulingfan

这个是自己想的概率解法,求大佬指点。

2253 次点击
所在节点    问与答
10 条回复
oblivious
2019-04-19 00:14:49 +08:00
合格:990 choose 100 / 1000 choose 100 = 0.347
不合格:1 - 0.347 = 0.653

简单验证:
from random import sample

failed = 0
repeat = 100000
for i in range(repeat):
list1 = ([0] * 990) + ([1] * 10)
sampled = sample(list1, 100)
if sum(sampled) > 0:
failed += 1

print(failed/repeat)

0.65397
[Finished in 8.4s]
oblivious
2019-04-19 00:15:56 +08:00
感觉很蠢因为代码不能缩进。

```
# 测试一下代码环境
if True:
print('Test...')
```
rrfeng
2019-04-19 00:23:37 +08:00
一个以上是指 2 个起

算合格概率:100 个全好,100 个有一个坏
oblivious
2019-04-19 00:26:44 +08:00
自闭了,求问怎么在 v2 打出漂亮的代码 block。

不死心:
<code>
if True:
print('Test...')
</code>
wAtcher789
2019-04-19 00:39:36 +08:00
可以看下超几何分布
fulingfan
2019-04-19 01:17:23 +08:00
@rrfeng 一个及一个以上
fulingfan
2019-04-19 01:19:14 +08:00
@oblivious
(```)
from random import sample

failed = 0
repeat = 100000
for i in range(repeat):
list1 = ([0] * 990) + ([1] * 10)
sampled = sample(list1, 100)
if sum(sampled) > 0:
failed += 1

print(failed/repeat)
(```)
fulingfan
2019-04-19 01:20:39 +08:00
@oblivious 回复里面不能用 markdown 语法,唉
fulingfan
2019-04-19 01:27:53 +08:00
@oblivious 测试下,markdown 语法下是可以显示缩进的
WinG
2019-04-19 02:20:05 +08:00
好像不需要排列组合.

全部及格的概率 : (990 / 1000) * (989 / 999) .................. (890 / 900)

不及格概率 1 - (990 / 1000) * (989 / 999) .................. (890 / 900)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/556610

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX