#include <iostream>
#include <vector>
#include <chrono>
#include <iostream>
#include <algorithm> // for copy
#include <iterator> // for ostream_iterator
static std::vector<uint64_t> prime;
int main() {
std::cout << "欝だしのう" << std::endl;
int num = 10000;
prime.reserve(num);
auto S = std::chrono::system_clock::now();
prime.push_back(2);
int j, k;
for (int i = 3; ;++i) {
int size = prime.size();
if (size >= num)
break;
bool isSosu = true;
for (j = 0; j < size; ++j) {
if (prime[j] * 2 > i)
break;
if (i % prime[j] == 0) {
isSosu = false;
break;
}
}
if (isSosu)
prime.push_back(i);
}
auto E = std::chrono::system_clock::now();
auto Eli = std::chrono::duration_cast<std::chrono::milliseconds>(E - S);
std::cout << "経過時間は" << Eli.count() << "ミリ秒だ!" << std::endl;
//copy(prime.begin(), prime.end(), std::ostream_iterator<uint64_t>(std::cout, " "));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y2hyb25vPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxhbGdvcml0aG0+IC8vIGZvciBjb3B5CiNpbmNsdWRlIDxpdGVyYXRvcj4gLy8gZm9yIG9zdHJlYW1faXRlcmF0b3IKCnN0YXRpYyBzdGQ6OnZlY3Rvcjx1aW50NjRfdD4gcHJpbWU7CgppbnQgbWFpbigpIHsKICBzdGQ6OmNvdXQgPDwgIuasneOBoOOBl+OBruOBhiIgPDwgc3RkOjplbmRsOwogIGludCBudW0gPSAxMDAwMDsKICBwcmltZS5yZXNlcnZlKG51bSk7CiAgCiAgYXV0byBTID0gc3RkOjpjaHJvbm86OnN5c3RlbV9jbG9jazo6bm93KCk7CiAgcHJpbWUucHVzaF9iYWNrKDIpOwogIGludCBqLCBrOwogIGZvciAoaW50IGkgPSAzOyA7KytpKSB7CiAgICBpbnQgc2l6ZSA9IHByaW1lLnNpemUoKTsKICAgIGlmIChzaXplID49IG51bSkKICAgICAgYnJlYWs7CiAgICBib29sIGlzU29zdSA9IHR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