結果
問題 |
No.65 回数の期待値の練習
|
ユーザー |
![]() |
提出日時 | 2019-01-06 02:34:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 343 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 167,912 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 23:40:59 |
合計ジャッジ時間 | 2,861 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include "bits/stdc++.h" using namespace std; void solve() { int N; cin >> N; vector<double> dp(N+1); for (int n = N-1; n >= 0; n--) { int x = min(6, N-n); dp[n] = 1; for (int i = x; i > 0; i--) { dp[n] += dp[n+i]/6; } } cout << dp[0] << endl; } int main() { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }