摘要: 埃拉托斯特尼筛法(The sieve of Eratosthenes) https://www.luogu.com.cn/problem/P3912 //只算出来了素数的个数 #include <cstdio> const int N = 100000010; bool isNotPrime[N]; 阅读全文
posted @ 2020-02-20 17:13 watchphone 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 转载自https://www.luogu.com.cn/blog/cicos/notprime!!! 2020 02 01 更新 想要快速地筛出一定上限内的素数? 下面这种方法可以保证范围内的每个合数都被删掉(在 bool 数组里面标记为非素数),而且任一合数只被: “最小质因数 × 最大因数(非自 阅读全文
posted @ 2020-02-20 16:34 watchphone 阅读(279) 评论(0) 推荐(0) 编辑