結果

問題 No.58 イカサマなサイコロ
ユーザー しらっ亭しらっ亭
提出日時 2015-08-22 12:13:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,835 ms / 5,000 ms
コード長 664 bytes
コンパイル時間 1,024 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 9,536 KB
最終ジャッジ日時 2023-09-25 16:03:55
合計ジャッジ時間 54,578 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,834 ms
9,468 KB
testcase_01 AC 4,835 ms
9,396 KB
testcase_02 AC 4,835 ms
9,408 KB
testcase_03 AC 4,834 ms
9,336 KB
testcase_04 AC 4,834 ms
9,536 KB
testcase_05 AC 4,835 ms
9,516 KB
testcase_06 AC 4,833 ms
9,520 KB
testcase_07 AC 4,834 ms
9,480 KB
testcase_08 AC 4,835 ms
9,444 KB
testcase_09 AC 4,834 ms
9,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
import threading
from time import sleep


def solve():
    N = int(input())
    K = int(input())

    stop_event = threading.Event()

    def monte():
        w = g = 0
        while not stop_event.is_set():
            x = y = 0
            for j in range(N):
                if j < K:
                    x += random.randint(4, 6)
                else:
                    x += random.randint(1, 6)
                y += random.randint(1, 6)
            g += 1
            if x > y:
                w += 1
        print(w / g)

    threading.Thread(target=monte).start()

    sleep(4.8)
    stop_event.set()


if __name__ == '__main__':
    solve()
0