我们一般写的埃氏筛消耗的时间都是欧拉筛的三倍,但是欧拉筛并不好想(对于我这种蒟蒻) 虽然 -- 我 -- 也可以背过模板,但是写个不会的欧拉筛不如写个简单易懂的埃氏筛 于是就有了优化 这个优化还是比较厉害的,能把埃氏筛的消耗的时间提的跟欧拉筛差不多 以下内容需要先学会埃氏筛 学会的埃氏筛就明白它的原理了吧 #include<bits/stdc++.h> using namespace std; int n, m ,Is_p[10000001]; int main() { cin >>…
Code: #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<iostream> #include<vector> using namespace std; typedef long long ll; const int maxn=10000+3; const int INF=100000+123; int s,t,n; st…