結果

問題 No.75 回数の期待値の問題
ユーザー nohtaraynohtaray
提出日時 2019-11-18 13:49:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 637 ms / 5,000 ms
コード長 457 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,064 KB
最終ジャッジ日時 2024-04-08 23:46:31
合計ジャッジ時間 15,959 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 635 ms
44,064 KB
testcase_01 AC 621 ms
43,436 KB
testcase_02 AC 624 ms
43,548 KB
testcase_03 AC 627 ms
43,548 KB
testcase_04 AC 620 ms
43,548 KB
testcase_05 AC 622 ms
43,560 KB
testcase_06 AC 619 ms
43,552 KB
testcase_07 AC 624 ms
43,676 KB
testcase_08 AC 616 ms
43,556 KB
testcase_09 AC 620 ms
44,064 KB
testcase_10 AC 623 ms
43,572 KB
testcase_11 AC 613 ms
43,672 KB
testcase_12 AC 620 ms
43,420 KB
testcase_13 AC 625 ms
43,676 KB
testcase_14 AC 624 ms
43,588 KB
testcase_15 AC 627 ms
43,928 KB
testcase_16 AC 636 ms
44,064 KB
testcase_17 AC 631 ms
43,676 KB
testcase_18 AC 637 ms
43,424 KB
testcase_19 AC 633 ms
43,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


K = int(sys.stdin.buffer.readline())

# X[i] = sum(X[i+1:i+7]) + 1
# 反復法で解く
ans = np.ones(K + 10)
ans[K] = 0
for _ in range(10000):
    cs = ans.cumsum()
    ans[:K] = (cs[6:] - cs[:-6])[:K] / 6 + 1
    ans[K + 1:] = ans[0]
print(ans[0])
0