2020年4月8日

摘要: 单源最短路径算法 #include<iostream> using namespace std; int map[50][50]; int book[50]; int n,m,min1,u; int dis[50]; int main(){ cin>>n>>m; for(int i=1;i<=n;i 阅读全文
posted @ 2020-04-08 20:58 二进制dd 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 任意2个点直接的最短路径: 首先分析确定2个点之间的最短路径: 比如A到B,要缩短A到B的路径就需要引入一个中转点K,有时可能需要多个中转点。A->k1->k2->B 如果不允许引入中转点那么A到B的最短路径就是A->B 插入1号城市,更新路径: 插入1,2城市,更新路径 求任意2点的最短路径就是求 阅读全文
posted @ 2020-04-08 15:42 二进制dd 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 图的邻接矩阵和图 图就是N个顶点和 M条边组成的集合 用二维数组存储图的邻接矩阵用dfs去遍历图 #include<iostream> using namespace std; int map[50][50]; int book[50]; int n,m,sum,sp; bool f; void d 阅读全文
posted @ 2020-04-08 10:25 二进制dd 阅读(245) 评论(0) 推荐(0) 编辑

2020年4月6日

摘要: #include<iostream> using namespace std; int n,m; int map[50][50]; int book[50][50]; bool f; struct node{ int x; int y; }a[50]; int top; void dfs(int x 阅读全文
posted @ 2020-04-06 16:16 二进制dd 阅读(177) 评论(0) 推荐(0) 编辑

2020年3月29日

摘要: 广度优先搜索解迷宫问题 #include<iostream> using namespace std; struct node{ int x; int y; int step; }; char map[1000][1000]; bool book[1000][1000]; int n,m,tx,ty 阅读全文
posted @ 2020-03-29 21:04 二进制dd 阅读(196) 评论(0) 推荐(0) 编辑
摘要: DFS:一条路走到黑 1.全排列问题: #include<iostream> using namespace std; int a[1000],book[1000]; int n; void dfs(int step){ if(step==n+1){ for(int i=1;i<=n;i++){ i 阅读全文
posted @ 2020-03-29 15:13 二进制dd 阅读(178) 评论(0) 推荐(0) 编辑

2020年3月28日

摘要: 恢复内容开始 有穷的枚举 1.炸弹人 #include<iostream> using namespace std; char map[1001][1001]; int n,m,x,y,sum,max1,mx,my; int main(){ cin>>n>>m; for(int i=0;i<n;i+ 阅读全文
posted @ 2020-03-28 19:53 二进制dd 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 指针的作用用来存储地址 int a; int *p; 定义一个存储整型变量的地址的指针 p=&a; 保存a的地址; pritnf("%d," *p); 输出p存储地址的值 *的作用{1.表乘法 2.申明一个指针,在定义指针变量时使用 3.间接运算符,取得指针所指向的内存中的值} #include<i 阅读全文
posted @ 2020-03-28 11:21 二进制dd 阅读(236) 评论(0) 推荐(0) 编辑

2020年3月26日

摘要: 1.Queue FIFO 解密一串数字将第一位删除,第二位移到数字串末尾,重复此操作,直到所有数字被删除,被删除的数字依次形成一个新数字串,解密完成,用队列实现该操作 #include<iostream> using namespace std; struct queue{ int data[100 阅读全文
posted @ 2020-03-26 16:07 二进制dd 阅读(141) 评论(0) 推荐(0) 编辑

2020年3月24日

摘要: 一.桶排序 #include<iostream> using namespace std; int a[1001]; int b[10]; int main(){ int count=1; for(int i=0;i<10;i++){ cin>>b[i]; a[b[i]]+=1; } for(int 阅读全文
posted @ 2020-03-24 12:20 二进制dd 阅读(167) 评论(0) 推荐(0) 编辑

导航