ajout exo

This commit is contained in:
2026-10-02 12:02:06 +02:00
parent cc001183fd
commit 1dfd3bac50
2 changed files with 182 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<stdint.h>
#include<assert.h>
#include "helpers.h"
uint64_t shots = 0,
shots_in = 0;
double pi = 0,
t1;
int main(int argc,char * argv[])
{
double x,y;
t1 = tstamp();
alarm(5);
while(1){
x = ((double)rand())/(double)RAND_MAX;
y = ((double)rand())/(double)RAND_MAX;
shots ++;
if ((x*x+y*y) <= 1)
shots_in ++;
}
}