結果

問題 No.75 回数の期待値の問題
ユーザー H3PO4H3PO4
提出日時 2020-06-26 00:02:35
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 224 ms / 5,000 ms
コード長 280 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 47,096 KB
最終ジャッジ日時 2023-09-16 23:18:59
合計ジャッジ時間 10,156 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
43,748 KB
testcase_01 AC 194 ms
43,536 KB
testcase_02 AC 194 ms
43,336 KB
testcase_03 AC 198 ms
43,440 KB
testcase_04 AC 194 ms
43,348 KB
testcase_05 AC 193 ms
43,372 KB
testcase_06 AC 193 ms
43,316 KB
testcase_07 AC 197 ms
43,408 KB
testcase_08 AC 195 ms
43,400 KB
testcase_09 AC 197 ms
43,392 KB
testcase_10 AC 199 ms
43,408 KB
testcase_11 AC 200 ms
43,244 KB
testcase_12 AC 191 ms
43,388 KB
testcase_13 AC 193 ms
43,396 KB
testcase_14 AC 193 ms
43,356 KB
testcase_15 AC 191 ms
43,516 KB
testcase_16 AC 204 ms
44,164 KB
testcase_17 AC 201 ms
44,552 KB
testcase_18 AC 224 ms
46,792 KB
testcase_19 AC 206 ms
47,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from scipy.linalg import null_space

K = int(input())
M = np.zeros((K, K + 1), dtype=int)
M[:, -1] = 6
for i in range(K):
    M[i, i + 1:min(i + 7, K)] = 1
    M[i, i] = -6
    M[i, 0] += max(i + 6 - K, 0)

Ker = null_space(M).flatten()
print(Ker[0] / Ker[-1])
0