摘要: 模板: #include<iostream> #include<cstdio> #define maxn 10010 using namespace std; template<typename T> inline void read(T &x){ x=0; bool flag=0; char c= 阅读全文
posted @ 2021-02-03 23:59 DReamLion 阅读(48) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define maxn 30 using namespace std; int n,f[maxn],a[maxn]; int ans=0; void LIS(){ for(int i=1;i<=n;i++){ f[i]=1; for(int j=1; 阅读全文
posted @ 2021-02-03 23:57 DReamLion 阅读(48) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstdio> using namespace std; int p,q,x,y; int exgcd(int a,int b,int &x,int &y){//a*x+b*y=gcd(a,b) if(b==0){ x=1; y=0; retu 阅读全文
posted @ 2021-02-03 08:19 DReamLion 阅读(50) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define maxn 100000010 using namespace std; int x; int cnt,isprime[maxn],mindiv[maxn]; bool notprime[maxn]; void shai(int n){ 阅读全文
posted @ 2021-02-03 08:02 DReamLion 阅读(71) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define maxn 1000010 using namespace std; int x; int cnt,isprime[maxn]; bool notprime[maxn]; void shai(int n){ for(int i=2;i<= 阅读全文
posted @ 2021-02-03 07:58 DReamLion 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度O(√n) #include<bits/stdc++.h> #include<iostream> using namespace std; int n; int main(){ cin>>n; if(n<2){ cout<<"Not Prime"<<endl; return 0; } fo 阅读全文
posted @ 2021-02-03 00:07 DReamLion 阅读(42) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; int x,cntd,d[510]; int cnt,isprime[510],ci[510];//isprime存因数,ci存每个因数出现的次数 void chai(int n){ for(int i=2;i 阅读全文
posted @ 2021-02-03 00:05 DReamLion 阅读(780) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; int x,cnt; int p[10010],ci[10010];//p存因数,ci存每个因数出现的次数 void chai(int n){ for(int i=2;i*i<=n;i++){ if(n%i== 阅读全文
posted @ 2021-02-03 00:04 DReamLion 阅读(40) 评论(0) 推荐(0) 编辑