#include <stdio.h>
#include <time.h>
#include <math.h>
int main(void) {
int count;
int i;
int j;
int k;
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; primes[j] <= k; 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+CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgY291bnQ7CglpbnQgaTsKCWludCBqOwoJaW50IGs7CglpbnQgYzsKCWludCBwcmltZTsKCWNsb2NrX3Qgc3RhcnQ7CgljbG9ja190IGVuZDsKCWRvdWJsZSBlbGFwc2VkOwoJaW50IHByaW1lc1sxMDBdOwoJCgkvKiBpbml0IHByaW1lcyAqLwoJcHJpbWVzWzBdID0gMjsKCWMgPSAxOwoJCgkvKiBpbnB1dCAqLwoJc2NhbmYoIiVkIiwgJmNvdW50KTsKCQoJLyogbWVhc3VyZSB0aW1lICovCglzdGFydCA9IGNsb2NrKCk7Cglmb3IgKGkgPSAzOyBjIDwgY291bnQ7IGkgKz0gMikgewoJCS8qIGlzUHJpbWUgKi8KCQlrID0gc3FydChpKTsKCQlwcmltZSA9IDE7CgkJZm9yIChqID0gMDsgcHJpbWVzW2pdIDw9IGs7IGorKykgewoJCQlpZiAoaSAlIHByaW1lc1tqXSA9PSAwKSB7CgkJCQlwcmltZSA9IDA7CgkJCQlicmVhazsKCQkJfQoJCX0KCQlpZiAocHJpbWUpIHsKCQkJcHJpbWVzW2NdID0gaTsKCQkJYyA9IGMgKyAxOwoJCX0KCX0KCWVuZCA9IGNsb2NrKCk7CgllbGFwc2VkID0gZW5kIC0gc3RhcnQ7CgkKCS8qIG91dHB1dCAqLwoJZm9yIChpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKCQlwcmludGYoIiVkICIsIHByaW1lc1tpXSk7Cgl9CglwcmludGYoIlxuIik7CglwcmludGYoImVsYXBzZWQgdGltZTolZlxuIiwgZWxhcHNlZCk7IAoJCglyZXR1cm4gMDsKfQ==