~cpp
#include <iostream>
#include <ctime>
#include <cmath>
using namespace std;
#define testcase 100000000
int main()
{
int i = testcase;
double x, y, length;
int number=0;
srand(time(NULL));
while(i--)
{
x= (double)rand()/RAND_MAX;
y= (double)rand()/RAND_MAX;
length = sqrt(x*x+y*y);
if(length<=1)
number++;
}
double pi = 4.0*number/testcase;
cout << pi <<endl;
return 0;
}










