#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <ctime>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <queue>
#include <memory.h>
#include <iostream>
#include <stack>
#include <complex>
#include <list>
using namespace std;
void ASS(bool b)
{
if (!b)
{
++*(int*)0;
}
}
#define FOR(i, x) for (int i = 0; i < (int)(x); i++)
#define CL(x) memset(x, 0, sizeof(x))
#define CLX(x, y) memset(x, y, sizeof(x))
#pragma comment(linker, "/STACK:106777216")
typedef vector<int> vi;
typedef long long LL;
double F(double n, double d)
{
return 1 - exp(- n * (n - 1) / (2 * d));
}
int main()
{
double n = 1e6;
double d = pow(2.0, 64.0);
// there is collision on one random test case
printf("%0.20lf\n", F(n, d));
double k = 100;
// there is no any coollisions on k test cases
printf("%0.20lf\n", 1 - pow(1 - F(n, d), k));
// there is coollision on k test cases
printf("%0.20lf\n", pow(1 - F(n, d), k));
// there is coollision on k test cases (the same as previous)
printf("%0.20lf\n", exp(k * - n * (n - 1) / (2 * d)));
double solCnt = 51;
// there is collision in any of solCnt solutions on k test cases
printf("%0.20lf\n", pow(1 - F(n, d), k * solCnt));
// there is no any collision in any of solCnt solutions on k test cases
printf("%0.20lf\n", 1 - pow(1 - F(n, d), k * solCnt));
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19ERVBSRUNBVEUKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPGN0aW1lPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxtYXRoLmg+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPG1lbW9yeS5oPgojaW5jbHVkZSA8aW9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