11 2020 档案
摘要:#include <bits/stdc++.h> using namespace std; const int MaxSize = 100000; typedef char ElemType; typedef struct{ ElemType data[MaxSize]; int top; }SqS
阅读全文
摘要:最小生成树:prim用于处理稠密图,因为他是以点为起点开始扩散,kruskal用于处理稀疏图,因为他以边为基准 Prim算法解决最小生成树问题,思路和Dijkstra很像 联系:Dijkstra算法是更新到起始点的距离,Prim是更新到生成树集合的距离 #include <iostream> #in
阅读全文
摘要:朴素版Dijkstra(适用于 无负权变的稠密图) #include <iostream> #include <cstring> using namespace std; const int N = 510; int n, m; int dis[N], g[N][N]; // dis数组存放起点到各
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; typedef char ElemType; typedef struct LNode{ ElemType data; struct LNode * next; }LinkNode; void Creator
阅读全文
摘要:// 莆林之光nb #include <bits/stdc++.h> using namespace std; const int MaxSize = 50; typedef char ElemType; typedef struct{ ElemType data[MaxSize]; int len
阅读全文
摘要:#include <iostream> #include <unordered_map> using namespace std; int main(){ unordered_map<int, int> hash; for(int i = 1; i <= 100; ++i){ int t = i;
阅读全文
摘要:约数与素数 //试除法求是否为素数 bool is_prime(int x){ if(x < 2) return false; // 对循环的次数做简单优化 for(int i = 2; i <= x / i; ++i){ if(x % i == 0) return false; } return
阅读全文

浙公网安备 33010602011771号