#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int heads_count[4] = {0, 0, 0, 0};
int trials = 100000;
int i, j;
for (i = 0; i < trials; i++) {
int heads = 0;
for (j = 0; j < 3; j++) {
heads++;
}
}
heads_count[heads]++;
}
printf("0枚の表: %d回\n", heads_count
[0]); printf("1枚の表: %d回\n", heads_count
[1]); printf("2枚の表: %d回\n", heads_count
[2]); printf("3枚の表: %d回\n", heads_count
[3]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4KCmludCBtYWluKCkgewogICAgaW50IGhlYWRzX2NvdW50WzRdID0gezAsIDAsIDAsIDB9OwogICAgaW50IHRyaWFscyA9IDEwMDAwMDsKICAgIGludCBpLCBqOwoKICAgIHNyYW5kKHRpbWUoTlVMTCkpOwoKICAgIGZvciAoaSA9IDA7IGkgPCB0cmlhbHM7IGkrKykgewogICAgICAgIGludCBoZWFkcyA9IDA7CgogICAgICAgIGZvciAoaiA9IDA7IGogPCAzOyBqKyspIHsKICAgICAgICAgICAgaWYgKHJhbmQoKSAlIDIgPT0gMSkgewogICAgICAgICAgICAgICAgaGVhZHMrKzsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgaGVhZHNfY291bnRbaGVhZHNdKys7CiAgICB9CgogICAgcHJpbnRmKCLooajjgYzlh7rjgZ/mnprmlbDjga7jg5Ljgrnjg4jjgrDjg6njg6A6XG4iKTsKICAgIHByaW50ZigiMOaemuOBruihqDogJWTlm55cbiIsIGhlYWRzX2NvdW50WzBdKTsKICAgIHByaW50ZigiMeaemuOBruihqDogJWTlm55cbiIsIGhlYWRzX2NvdW50WzFdKTsKICAgIHByaW50ZigiMuaemuOBruihqDogJWTlm55cbiIsIGhlYWRzX2NvdW50WzJdKTsKICAgIHByaW50ZigiM+aemuOBruihqDogJWTlm55cbiIsIGhlYWRzX2NvdW50WzNdKTsKCiAgICByZXR1cm4gMDsKfQo=