結果

問題 No.65 回数の期待値の練習
ユーザー 👑 H20H20
提出日時 2021-05-18 16:57:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 275 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-04-17 06:09:36
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,584 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 37 ms
51,824 KB
testcase_03 AC 37 ms
51,712 KB
testcase_04 AC 37 ms
51,840 KB
testcase_05 AC 37 ms
51,456 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 37 ms
51,584 KB
testcase_08 AC 38 ms
51,840 KB
testcase_09 AC 43 ms
59,264 KB
testcase_10 AC 46 ms
61,696 KB
testcase_11 AC 52 ms
64,768 KB
testcase_12 AC 60 ms
70,912 KB
testcase_13 AC 57 ms
75,648 KB
testcase_14 AC 61 ms
75,776 KB
testcase_15 AC 63 ms
75,620 KB
testcase_16 AC 68 ms
75,648 KB
testcase_17 AC 78 ms
75,776 KB
testcase_18 AC 90 ms
75,608 KB
testcase_19 AC 119 ms
75,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
ans = 0
#合計、回数、確率
def dfs(S,C,P):
    global ans
    if S>=K:
        ans+=C*P
        return
    dfs(S+1,C+1,P/6)
    dfs(S+2,C+1,P/6)
    dfs(S+3,C+1,P/6)
    dfs(S+4,C+1,P/6)
    dfs(S+5,C+1,P/6)
    dfs(S+6,C+1,P/6)

dfs(0,0,1)
print(ans)
0