結果
| 問題 | No.75 回数の期待値の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-30 00:49:36 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 133µs | |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 1,046 ms |
| コンパイル使用メモリ | 215,168 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-12 23:30:28 |
| 合計ジャッジ時間 | 2,361 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int K; cin >> K;
vector<double> P(K+1);
P.at(0) = 1;
double answer = 0;
for(int i=0; i<K; i++){
answer += P.at(i);
for(int k=1; k<=6; k++) if(i+k <= K) P.at(i+k) += P.at(i)*0.166666666;
}
answer *= 1/P.at(K);
cout << fixed << setprecision(20) << answer << endl;
}