#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
long long i = 0, d = 1000000000, c = 0;
float x = 0, y = 0;
srand((unsigned int)time(NULL));
for (long i = 0; i < d; ++i) //这么大的数需要计算的时间还是挺久的,不过PI的值很接近了
{
x = (float)rand() / RAND_MAX;
y = (float)rand() / RAND_MAX;
if (sqrt(x * x + y * y) <= 1)
++c;
}
cout << setiosflags(ios::fixed) << setprecision(20) << acos(-1.0) << endl;
system("pause");
return 0;
}