結果

問題 No.76 回数の期待値で練習
ユーザー gigurururu
提出日時 2014-11-25 16:31:12
言語 Python2
(2.7.18)
結果
AC  
実行時間 2,089 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 69,760 KB
最終ジャッジ日時 2025-01-02 21:49:15
合計ジャッジ時間 7,318 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

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