- 博客(9)
- 收藏
- 关注
原创 【HDU 1247】字典树 一个单词由两个单词组成
#include #include #include using namespace std; #define MAX 26 struct node; typedef struct node *NumTree; struct node { int tag; NumTree ans[MAX]; }; NumTree init(NumTree T) { int i;
2014-06-14 17:52:59 1178
原创 【HDU 3790】双权最短路
#include #include #include #include using namespace std; #define MAX 1100 #define INF 99999 int map[MAX][MAX]; int cost[MAX][MAX]; int n,m; void init() { int i,j; for(i=1;i<=MAX;i++) { for(j
2014-06-14 15:34:31 448
原创 【HDU2544】记第一次写Floyd
#include #include using namespace std; #define MAX 105 #define INF 9999999 int map[MAX][MAX]; int n,m; void init() { int i,j; for(i=0;i<MAX;i++) { for(j=0;j<MAX;j++) { if(i==j) map[i
2014-06-14 14:08:39 423
转载 【最短路三算法】Floyd,Dijkstra,SPFA.
#include #include #include #include using namespace std; const int N = 105; const int INF = 99999999; int map[N][N], dist[N]; bool visit[N]; int n, m; void init()
2014-06-12 19:19:24 429
原创 【prim】算法
#include #include #include #define MAX 100000 int map[100][100]; void init(int n) { int i,j; for(i=0;i<n;i++) { for(j=0;j<n;j++) map[i][j]=MAX; } } int Prim(int n) { int i,j; int min
2014-06-12 15:44:44 369
原创 【Kruskal】算法 最小生成树
#include #include using namespace std; #define MAX 10000 struct edge { int u,v; int price,vis; }Edge[MAX]; int n,m; int ans[MAX]; bool cmp(edge x,edge y) { if(x.vis!=y.vis) return x.vis<y.vi
2014-06-12 15:39:34 409
原创 字典树【附加Free例程】
#include #include using namespace std; #define points 26 struct node; typedef struct node *NumTree; struct node { int count; NumTree N[points]; }; NumTree init(NumTree T) { T=new struct node;
2014-06-10 16:53:04 592 4
转载 [STL]next_permutation全排列
四处搜罗好东西,哈哈 这是一个求一个排序的下一个排列的函数,可以遍历全排列,要包含头文件 下面是以前的笔记 与之完全相反的函数还有prev_permutation (1) int 类型的next_permutation int main() { int a[3]; a[0]=1;a[1]=2;a[2]=3; do { cout }
2014-06-10 13:39:32 402
转载 图搜索总结
转载自:http://blog.csdn.net/urecvbnkuhbh_54245df/article/details/5847876 图的搜索分类: BFS(广度优先搜索) 和 DFS(深度优先搜索) 两个最基本的搜索,一个是按深度进行搜索,另一个是按广度进行搜索... 记忆化搜索(基于深搜) 就是用一个数组,dp[s
2014-06-07 11:43:57 434
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人