Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- uint32_t xor128(void) {
- static uint32_t x = 123456789;
- static uint32_t y = 362436069;
- static uint32_t z = 521288629;
- static uint32_t w = 88675123;
- uint32_t t;
- t = x ^ (x << 11);
- x = y; y = z; z = w;
- return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
- }
- using namespace std;
- const int N = 1000000;
- int result[N];
- int main() {
- for (int i = 0; i < N; i++) {
- int success = 0;
- int meld = 0;
- while (true) {
- meld++;
- if (xor128() % 100 < 17) {
- success++;
- if (success >= 12) break;
- }
- }
- result[i] = meld;
- }
- sort(result, result + N);
- cout << "80 percentile: " << (18 + result[N * 80 / 100]) << endl;
- cout << "90 percentile: " << (18 + result[N * 90 / 100]) << endl;
- cout << "95 percentile: " << (18 + result[N * 95 / 100]) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement