結果

問題 No.76 回数の期待値で練習
ユーザー gigurururugigurururu
提出日時 2014-11-25 16:31:12
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,802 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 6,728 KB
実行使用メモリ 69,440 KB
最終ジャッジ日時 2023-08-30 22:58:46
合計ジャッジ時間 6,468 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,798 ms
69,372 KB
testcase_01 AC 1,802 ms
69,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p=[]
e=[ 1.0000000000000000,
    1.0833333333333333,
    1.2569444444444444,
    1.5353009259259260,
    1.6915991512345676,
    2.0513639724794235]

for i in range(1,6):
    p.append(e[i]+sum(p)-1-sum([pi*(ei+1) for pi,ei in zip(p,e[i-1::-1])]))

p.append(1-sum(p))

for i in range(6,1000000+1):
    e.append(1+sum([pi*ei for pi,ei in zip(p,e[:-7:-1])]))

for _ in range(input()):
    print e[input()-1]
0