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