上一页 1 ··· 5 6 7 8 9
摘要: #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 阅读(725) 评论(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) 编辑
摘要: Dijkstra算法 时间复杂度O(N2)。 单源最短路径算法,边权非负,基于贪心思想。 算法描述: 设起点为s,dis[v]表示从s到v的最短路径,pre[v]为v的前驱节点,用来输出路径。 (a)初始化:dis[v]=0x7fffffff;dis[v]=0;pre[s]=0; (b)for(in 阅读全文
posted @ 2021-02-02 08:12 DReamLion 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9