結果

問題 No.58 イカサマなサイコロ
ユーザー vwxyzvwxyz
提出日時 2021-09-23 21:05:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 7,912 KB
最終ジャッジ日時 2023-09-18 19:57:41
合計ジャッジ時間 1,024 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,876 KB
testcase_01 AC 19 ms
7,912 KB
testcase_02 AC 17 ms
7,808 KB
testcase_03 AC 17 ms
7,756 KB
testcase_04 AC 18 ms
7,868 KB
testcase_05 AC 19 ms
7,816 KB
testcase_06 AC 19 ms
7,676 KB
testcase_07 AC 17 ms
7,772 KB
testcase_08 AC 17 ms
7,868 KB
testcase_09 AC 18 ms
7,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
K=int(input())
dp0=[0]*(61)
dp0[0]=1
for _ in range(N):
    prev=dp0
    dp0=[0]*61
    for i in range(61):
        for j in range(1,7):
            if i+j<=60:
                dp0[i+j]+=prev[i]
dp1=[0]*(61)
dp1[0]=1
for _ in range(N-K):
    prev=dp1
    dp1=[0]*61
    for i in range(61):
        for j in range(1,7):
            if i+j<=60:
                dp1[i+j]+=prev[i]
for _ in range(K):
    prev=dp1
    dp1=[0]*61
    for i in range(61):
        for j in range(4,7):
            if i+j<=60:
                dp1[i+j]+=2*prev[i]
ans=0
for j in range(61):
    for i in range(j):
        ans+=dp0[i]*dp1[j]
ans/=6**(2*N)
print(ans)
0