>>160

#include <stdio.h>
const int max = 1000000;

int teacher(void)/* 開講: 1, 休講: 0 */
{
static int st = 1;
if (st == 0 && rand() % 10 != 0)
st = 1;
if (st == 1 && rand() % 10 < 3)
st = 0;
return st;
}

int main(int argc, char* argv[])
{
int i, count;

srand(time(NULL));
for (i = 0; i < max; i++) {
if (teacher()) { count++; }
}
printf("%d (%lf%%)¥n", count, (double)count / max * 100);
return 0;
}