結果

問題 No.58 イカサマなサイコロ
ユーザー fmhrfmhr
提出日時 2015-04-22 03:42:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 539 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 8,948 KB
最終ジャッジ日時 2023-09-18 07:49:21
合計ジャッジ時間 30,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 TLE -
testcase_02 AC 1,198 ms
8,680 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2,223 ms
8,836 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
N = int(input())
K = int(input())
result = [0, 0, 0]
NUM = (10 ** 5) * 2
table = ([1] * K) + ([0] * (N-K))


random.seed()
for i in range(NUM):
    taro = 0
    jiro = 0
    for j in range(N):
        jiro += random.randrange(1, 7)
        if random.sample(table, 1) == [1]:
            taro += random.randrange(4, 7)
        else:
            taro += random.randrange(1, 7)
    if taro > jiro:
        result[0] += 1
    if taro < jiro:
        result[1] += 1
    if taro == jiro:
        result[2] += 1
print(result[0]/NUM)
0