結果
| 問題 |
No.75 回数の期待値の問題
|
| ユーザー |
hashiryo
|
| 提出日時 | 2019-04-08 20:22:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 181 ms / 5,000 ms |
| コード長 | 1,237 bytes |
| コンパイル時間 | 724 ms |
| コンパイル使用メモリ | 94,676 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 22:54:15 |
| 合計ジャッジ時間 | 2,152 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>
#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const double INF = DBL_MAX;
const ll MOD = 998244353;
int K;
double dp[210];
int main(){
cin >>K;
repeat(c,100000){
repeat(i,K){
double tmp=1;
repeat(j,6){
int jj=i+1+j;
if(jj==K)continue;
if(jj>K)jj=0;
tmp += dp[jj]/6;
}
swap(tmp,dp[i]);
}
}
printf("%.8lf\n",dp[0]);
return 0;
}
hashiryo