摘要:
单源最短路径算法 #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 阅读全文
摘要:
图的邻接矩阵和图 图就是N个顶点和 M条边组成的集合 用二维数组存储图的邻接矩阵用dfs去遍历图 #include<iostream> using namespace std; int map[50][50]; int book[50]; int n,m,sum,sp; bool f; void d 阅读全文
摘要:
#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 阅读全文
摘要:
广度优先搜索解迷宫问题 #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 阅读全文
摘要:
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 阅读全文
摘要:
一.桶排序 #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 阅读全文