結果
問題 | No.65 回数の期待値の練習 |
ユーザー |
![]() |
提出日時 | 2018-12-28 20:43:10 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 498 bytes |
コンパイル時間 | 501 ms |
コンパイル使用メモリ | 59,092 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 15:02:02 |
合計ジャッジ時間 | 1,053 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 WA * 13 |
ソースコード
#include <iostream>#include <algorithm>#include <cstdio>#include <string>#include <vector>#include <numeric>#define ll long longusing namespace std;//E(x)=E(x+1)∗1/6+E(x+2)∗1/6+E(x+3)∗1/6+E(x+4)∗1/6+E(x+5)∗1/6+E(x+6)∗1/6+1int main(){int k;cin>>k;double E[21];E[0]=0;E[1]=1;for(int i=2;i<=7;++i) E[i]=E[i-1]*((double)7/6);for(int i=8;i<=20;++i) E[i]=(E[i-1]+E[i-2]+E[i-3]+E[i-4]+E[i-5]*E[i-6])/6+1;printf("%.5lf\n",E[k]);return 0;}