0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

勝率1%の勝負を勝つまでn回やると何%の割合で勝つか[simulation]

Last updated at Posted at 2025-08-17

勝率1%の勝負を勝つまでやると何%の確率で勝つか。シミュレーション。

prob.py
#!/usr/bin/env python3
def main(n):
    a=(99/100)**n
    print(f"勝率1%の賭けを勝つまで{n}回すると{(1-a)*100}% の割合で勝つ。")

if __name__=='__main__':
    a=int(input("試行回数:"))
    main(a)
    exit(0)
実行例
% prob.py
試行回数:100
勝率1%の賭けを勝つまで100回すると63.396765872677086% の割合で勝つ。

総合的に勝率1%だったら、1%しか勝てませんが。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?