結果
| 問題 |
No.65 回数の期待値の練習
|
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2016-01-02 18:01:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,064 bytes |
| コンパイル時間 | 1,251 ms |
| コンパイル使用メモリ | 100,892 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 09:42:00 |
| 合計ジャッジ時間 | 1,916 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
typedef long long ll;
int const inf = 1<<29;
double E[100];
int main() {
int K; cin >> K; K+=50;
rep(i, 6) E[K+i] = 0;
for(int x=K-1; x>=0; x--) {
E[x]=E[x+1]*1/6+E[x+2]*1/6+E[x+3]*1/6+E[x+4]*1/6+E[x+5]*1/6+E[x+6]*1/6+1;
}
printf("%.9f\n", E[50]);
return 0;
}
moti