#include<iostream>
#include<bitset>
#include<cmath>
using namespace std;
int main()
{
const int a(1000);
const int b = sqrt(a);
bitset<a>num;
num.set();
num[1] = 0;
for (int i = 1; i <= a; i++)
{
for (int j = i * i; j <= b; j+=i)
{
num[j] = 0;
}
}
cout << a<< "有" << num.count() << "质数" << endl;
for (int i = 1; i <= a; i++)
{
if (num[i] = 1)
cout << i << endl;
}
return 0;
}
慕的地6079101
慕粉3342523
rubyc
rubyc
蹬着三轮车去上学
相关分类