結果

問題 No.58 イカサマなサイコロ
ユーザー 👑 colognecologne
提出日時 2022-01-24 21:28:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 774 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 76,392 KB
最終ジャッジ日時 2023-08-21 12:44:01
合計ジャッジ時間 1,901 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,268 KB
testcase_01 AC 78 ms
76,312 KB
testcase_02 AC 69 ms
71,464 KB
testcase_03 AC 74 ms
71,396 KB
testcase_04 AC 71 ms
71,576 KB
testcase_05 AC 73 ms
75,664 KB
testcase_06 AC 78 ms
76,392 KB
testcase_07 AC 71 ms
71,264 KB
testcase_08 AC 71 ms
71,364 KB
testcase_09 AC 76 ms
75,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():

    def normal(a):
        b = [0]*(len(a)+6)
        for i in range(len(a)):
            for j in range(1, 7):
                b[i+j] += a[i] / 6
        return b

    def cheat(a):
        b = [0]*(len(a)+6)
        for i in range(len(a)):
            for j in range(4, 7):
                b[i+j] += a[i] / 3
        return b

    N = int(input())
    K = int(input())

    x = [1]
    for i in range(N):
        x = normal(x)
    y = [1]
    for i in range(K):
        y = cheat(y)

    for i in range(N-K):
        y = normal(y)

    ans = 0
    for i in range(len(x)):
        for j in range(i+1, len(y)):
            ans += x[i]*y[j]

    print(ans)


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