上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 37 下一页
摘要: 数据有1万个,邻接矩阵挂了,所以只能套邻接表。第一次直接是套的模板,搜索过程也是参考教材指导书上的实现。#include#include#include#include#includeusing namespace std;#define MaxVertexNum 1024typ... 阅读全文
posted @ 2015-05-05 13:05 xryz 阅读(290) 评论(0) 推荐(0) 编辑
摘要: /* 图的邻接矩阵表示法(C语言实现) */#define MaxVertexNum 100 /* 最大顶点数设为100 */#define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/typedef char Ver... 阅读全文
posted @ 2015-05-04 20:45 xryz 阅读(200) 评论(0) 推荐(0) 编辑
摘要: dfs和bfs综合利用,栈和队列也是综合利用,比较考验编程基本功,主要是自己交一次就对了,好高兴。#include#include#include#include#includeusing namespace std;int gra[15][15],vis[15],ans[15],n... 阅读全文
posted @ 2015-05-04 14:38 xryz 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 突然发现堆排序不会了//25ms,stl自带,干过他真难#include#includeusing namespace std;int main(){ int a[100000+5],i,n; while(~scanf("%d",&n)) { for(... 阅读全文
posted @ 2015-05-04 13:57 xryz 阅读(161) 评论(0) 推荐(0) 编辑
摘要: /* ***********************************************Author :xryzEmail :523689985@qq.comCreated Time :5-3 19:23:22File Name :... 阅读全文
posted @ 2015-05-03 20:09 xryz 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #includestruct node{ int parent; int up; int all;} n[30000+5];int Find(int x){ if(x!=n[x].parent) { int t=Find(n[x].pare... 阅读全文
posted @ 2015-05-03 16:56 xryz 阅读(143) 评论(0) 推荐(0) 编辑
摘要: int find(int x) { if(fa[x] == x) return x; fa[x] = find(fa[x]); return fa[x];}void unio(int x, int y) { int fx = fin... 阅读全文
posted @ 2015-05-03 13:32 xryz 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #includeint bin[1024];int findx(int x){ while(bin[x]!=x) x=bin[x]; return x;}void mergeab(int x,int y){ int fx,fy; fx=findx... 阅读全文
posted @ 2015-05-03 10:06 xryz 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #includeint bin[1024];int findx(int x){ while(bin[x]!=x) x=bin[x]; return x;}void mergeab(int x,int y){ int fx,fy; fx=findx... 阅读全文
posted @ 2015-05-03 10:02 xryz 阅读(94) 评论(0) 推荐(0) 编辑
摘要: hljs perl">#include#includeusing namespace std;int flag,t,n,a[20],use[20],ans[20];bool cmp(int x,int y){ return x>y;}void dfs(int sum,int ... 阅读全文
posted @ 2015-05-02 16:48 xryz 阅读(100) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 37 下一页