#include <stdio.h>
#include <time.h>
int main(void) {
int count;
int i;
int j;
int k;
int c;
int prime;
clock_t start;
clock_t end;
double elapsed;
/* input */
/* measure time */
c = 1;
i = 3;
while (c < count) {
/* isPrime */
j = i;
k = 3;
prime = 1;
while (k < j) {
if (i % k == 0) {
prime = 0;
break;
}
k = k + 2;
}
/* output */
if (prime) {
c = c + 1;
}
i = i + 2;
}
elapsed = end - start;
printf("elapsed time:%f\n", elapsed
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDx0aW1lLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgY291bnQ7CglpbnQgaTsKCWludCBqOwoJaW50IGs7CglpbnQgYzsKCWludCBwcmltZTsKCWNsb2NrX3Qgc3RhcnQ7CgljbG9ja190IGVuZDsKCWRvdWJsZSBlbGFwc2VkOwoJCgkvKiBpbnB1dCAqLwoJc2NhbmYoIiVkIiwgJmNvdW50KTsKCQoJLyogbWVhc3VyZSB0aW1lICovCglzdGFydCA9IGNsb2NrKCk7CglwcmludGYoIjJcbiIpOwoJYyA9IDE7CglpID0gMzsKCXdoaWxlIChjIDwgY291bnQpIHsKCQkvKiBpc1ByaW1lICovCgkJaiA9IGk7CgkJayA9IDM7CgkJcHJpbWUgPSAxOwoJCXdoaWxlIChrIDwgaikgewoJCQlpZiAoaSAlIGsgPT0gMCkgewoJCQkJcHJpbWUgPSAwOwoJCQkJYnJlYWs7CgkJCX0KCQkJayA9IGsgKyAyOwoJCX0KCQkKCQkvKiBvdXRwdXQgKi8KCQlpZiAocHJpbWUpIHsKCQkJYyA9IGMgKyAxOwoJCQlwcmludGYoIiVkXG4iLCBpKTsKCQl9CgkJCgkJaSA9IGkgKyAyOwoJfQoJZW5kID0gY2xvY2soKTsKCQoJZWxhcHNlZCA9IGVuZCAtIHN0YXJ0OwoJcHJpbnRmKCJlbGFwc2VkIHRpbWU6JWZcbiIsIGVsYXBzZWQpOyAKCQoJcmV0dXJuIDA7Cn0=