結果

問題 No.58 イカサマなサイコロ
ユーザー しらっ亭しらっ亭
提出日時 2015-08-22 12:14:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,701 ms / 5,000 ms
コード長 664 bytes
コンパイル時間 1,566 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 85,236 KB
最終ジャッジ日時 2023-09-25 16:06:07
合計ジャッジ時間 53,169 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,694 ms
82,780 KB
testcase_01 AC 4,689 ms
82,848 KB
testcase_02 AC 4,700 ms
82,684 KB
testcase_03 AC 4,688 ms
82,632 KB
testcase_04 AC 4,696 ms
85,236 KB
testcase_05 AC 4,696 ms
82,656 KB
testcase_06 AC 4,692 ms
82,528 KB
testcase_07 AC 4,691 ms
82,892 KB
testcase_08 AC 4,697 ms
82,272 KB
testcase_09 AC 4,701 ms
82,708 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.5)
    stop_event.set()


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