結果
| 問題 | No.65 回数の期待値の練習 |
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2020-03-26 15:16:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 338 bytes |
| コンパイル時間 | 1,604 ms |
| コンパイル使用メモリ | 160,996 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 01:53:06 |
| 合計ジャッジ時間 | 2,081 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ld=long double;
ld dp[30];
ld f(int n,int k){
if(dp[n]>=0)return dp[n];
if(n>=k)return 0;
ld res=1;
for(int i=0;i<6;i++)res+=f(n+i+1,k)/6;
return dp[n]=res;
}
signed main(){
for(int i=0;i<30;i++)dp[i]=-1;
int k;cin>>k;
cout<<fixed<<setprecision(12)<<f(0,k)<<endl;
}
cureskol