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