結果
| 問題 |
No.75 回数の期待値の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-30 00:49:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 431 bytes |
| コンパイル時間 | 2,020 ms |
| コンパイル使用メモリ | 195,504 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2025-06-30 00:49:39 |
| 合計ジャッジ時間 | 2,812 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}