結果
| 問題 | No.75 回数の期待値の問題 |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-01-03 20:56:39 |
| 言語 | C++17(clang) (clang++ 22.1.2 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 853 bytes |
| 記録 | |
| コンパイル時間 | 4,110 ms |
| コンパイル使用メモリ | 148,352 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2026-05-01 01:37:23 |
| 合計ジャッジ時間 | 31,478 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 TLE * 1 |
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
unsigned long long xor128() {
static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123;
unsigned long long rt = (rx ^ (rx << 11));
rx = ry;
ry = rz;
rz = rw;
return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8)));
}
int main() {
int K;
cin >> K;
ll loop_cnt = 10000000;
ll sum = 0;
for (int i = 0; i < loop_cnt; ++i) {
int n = 0;
int cnt = 0;
while (n < K) {
n += (xor128() % 6) + 1;
if (n > K) n = 0;
++cnt;
}
sum += cnt;
}
cout << fixed << setprecision(10) << sum / (double) loop_cnt << endl;
return 0;
}
siman