結果

問題 No.65 回数の期待値の練習
ユーザー iomir
提出日時 2023-04-21 19:47:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 402 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 167,760 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 13:38:58
合計ジャッジ時間 2,759 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;

int main(){
    ll K;
    cin>>K;
    vector<double> dp(100);
    for(int i=K-1;i>=0;i--){
        for(int j=1;j<=6;j++){
            dp[i]+=dp[i+j]/6;
        }
        dp[i]++;
    }
    cout << dp[0] << endl;
}
0