結果
| 問題 |
No.65 回数の期待値の練習
|
| コンテスト | |
| ユーザー |
kei
|
| 提出日時 | 2016-08-26 15:41:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 359 bytes |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 55,128 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 04:10:21 |
| 合計ジャッジ時間 | 1,503 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <iostream>
using namespace std;
inline double cal_exp(int x,int K) {
double e = 1;
if (x < K) {
for (int i = 1; i <= 6; i++) {
e += cal_exp(x + i,K) / 6.0;
}
}
else {
return 0;
}
return e;
}
int main() {
cin.tie(0); ios::sync_with_stdio(false);
double ans; cin >> ans;
ans = cal_exp(0,(int)ans);
cout << ans << endl;
return 0;
}
kei