周笔畅新歌HelloWorld《分手大师》插曲# TVChinese - 中文电视
c*f
1 楼
const int size = 1024;
bitset sieve;
sieve.flip();
int finalBit = sqrt(sieve.size())+1;
for (int i=2;i if (sieve.test(i))
for(int j = 2*i;j sieve.reset(j);
Question:
In this program we set all 1024 bits as all "1"(which means 1111...111)
here we will find 2 and set all numbers like 4, 6, 8, ...,10 to 0
then find 3 and set all numbers like 6,9,12...to 0
then find 4 and set all numbers like 8,12,...to 0
until the loop is finished, we will find
bitset
sieve.flip();
int finalBit = sqrt(sieve.size())+1;
for (int i=2;i
for(int j = 2*i;j
Question:
In this program we set all 1024 bits as all "1"(which means 1111...111)
here we will find 2 and set all numbers like 4, 6, 8, ...,10 to 0
then find 3 and set all numbers like 6,9,12...to 0
then find 4 and set all numbers like 8,12,...to 0
until the loop is finished, we will find