結果
問題 |
No.65 回数の期待値の練習
|
ユーザー |
![]() |
提出日時 | 2024-08-07 20:53:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 4,211 ms |
コンパイル使用メモリ | 276,396 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-07 20:53:45 |
合計ジャッジ時間 | 4,743 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<double> memo(30,-1); double E(int x,int K){ if(x>=K)return 0; if(memo[x]!=-1)return memo[x]; double c=(E(x+1,K)+E(x+2,K)+E(x+3,K)+E(x+4,K)+E(x+5,K)+E(x+6,K))/6+1; memo[x]=c; return c; } int main(){ int K;cin>>K; cout<<fixed<<setprecision(20); cout<<E(0,K)<<endl; }