結果
| 問題 | No.76 回数の期待値で練習 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-08 03:17:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 583 ms / 5,000 ms |
| コード長 | 771 bytes |
| コンパイル時間 | 1,553 ms |
| コンパイル使用メモリ | 167,048 KB |
| 実行使用メモリ | 19,100 KB |
| 最終ジャッジ日時 | 2024-07-16 01:01:55 |
| 合計ジャッジ時間 | 2,629 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
double p[6];
double E[6];
vector<double> dp;
int main()
{
int t;
cin >> t;
E[0] = 1.0000000000000000;
E[1] = 1.0833333333333333;
E[2] = 1.2569444444444444;
E[3] = 1.5353009259259260;
E[4] = 1.6915991512345676;
E[5] = 2.0513639724794235;
p[0] = E[1]-1;
p[1] = E[2]-E[1]*p[0]-1;
p[2] = E[3]-E[2]*p[0]-E[1]*p[1]-1;
p[3] = E[4]-E[3]*p[0]-E[2]*p[1]-E[1]*p[2]-1;
p[4] = E[5]-E[4]*p[0]-E[3]*p[1]-E[2]*p[2]-E[1]*p[3]-1;
p[5] = 1-p[0]-p[1]-p[2]-p[3]-p[4];
for(int ii = 0;ii<t;ii++)
{
dp = vector<double>(1000010,0);
int x;
cin >> x;
for(int i = x-1;i>=0;i--)
{
for(int j = 0;j<6;j++)
{
dp[i] += (dp[i+j+1]+1.0)*p[j];
}
}
printf("%.15lf\n",dp[0]);
}
return 0;
}