#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double f
(double x
, double y
) { return sqrt(x
* x
+ y
* y
); }
int g(int s, int n) {
return (n == 0) ? s
: (f
((double)rand() / RAND_MAX
, (double)rand() / RAND_MAX
)) < 1.0 ? g(s + 1, n - 1)
: g(s, n - 1);
}
#define SEED 31415926
#define N 100000
int main() {
printf("%f\n", 4.0 * g
(0, N
) / N
); return 0;
}
/* end */
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPG1hdGguaD4KCmRvdWJsZSBmKGRvdWJsZSB4LCBkb3VibGUgeSkgeyByZXR1cm4gc3FydCh4ICogeCArIHkgKiB5KTsgfQoKaW50IGcoaW50IHMsIGludCBuKSB7CiAgcmV0dXJuIChuID09IDApID8gcwogICAgICAgICAgICAgICAgICA6IChmKChkb3VibGUpcmFuZCgpIC8gUkFORF9NQVgsIChkb3VibGUpcmFuZCgpIC8gUkFORF9NQVgpKSA8IDEuMAogICAgICAgICAgICAgICAgICAgID8gZyhzICsgMSwgbiAtIDEpCiAgICAgICAgICAgICAgICAgICAgOiBnKHMsIG4gLSAxKTsKfQoKI2RlZmluZSBTRUVEIDMxNDE1OTI2CiNkZWZpbmUgTiAxMDAwMDAKaW50IG1haW4oKSB7CiAgc3JhbmQoU0VFRCk7CiAgcHJpbnRmKCIlZlxuIiwgNC4wICogZygwLCBOKSAvIE4pOwogIHJldHVybiAwOwp9Ci8qIGVuZCAqLwo=