結果
問題 | No.76 回数の期待値で練習 |
ユーザー |
![]() |
提出日時 | 2014-11-23 23:46:22 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 994 bytes |
コンパイル時間 | 1,013 ms |
コンパイル使用メモリ | 84,440 KB |
実行使用メモリ | 18,272 KB |
最終ジャッジ日時 | 2025-01-02 20:39:30 |
合計ジャッジ時間 | 1,942 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 2 |
ソースコード
#define _USE_MATH_DEFINES#include <algorithm>#include <cstdio>#include <functional>#include <iostream>#include <cfloat>#include <climits>#include <cstring>#include <cmath>#include <map>#include <queue>#include <set>#include <sstream>#include <stack>#include <string>#include <time.h>#include <vector>using namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair<int, int> i_i;typedef pair<ll, int> ll_i;typedef pair<double, int> d_i;typedef pair<ll, ll> ll_ll;typedef pair<double, double> d_d;struct edge { int u, v; ll w; };ll MOD = 1000000007;ll _MOD = 1000000009;double EPS = 1e-10;int a[] = {1, 2, 3, 1, 2, 3};int main() {int T; cin >> T;while (T--) {int N; cin >> N;vector<double> dp(N + 1, 1);dp[0] = 0;for (int i = 1; i <= N; i++)for (int j = 1; j <= 6; j++) {int _i = max(0, i - j);dp[i] += dp[_i] * a[j - 1] / 12;}printf("%.10f\n", dp[N]);}}