結果
問題 | No.65 回数の期待値の練習 |
ユーザー | ふう |
提出日時 | 2015-01-26 11:27:53 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 82,436 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 03:13:56 |
合計ジャッジ時間 | 1,690 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <iostream> #include <map> #include <list> #include <cstdio> #include <cmath> #include <cstring> #include <string> #include <vector> #include <algorithm> #include <utility> #include <queue> #include <iomanip> using namespace std; double e(int x, int k) { double res = 0; if (x >= k) return (0); for (int i = 1; i <= 6; i++) { res += e(x + i, k) / 6; } return (res + 1); } int main(void) { int k; cin >> k; cout << e(0, k) << endl; return (0); }