摘要: #include<bits/stdc++.h> using namespace std; int n; vector<int>g[1005]; int s=0; int a[1005][1005]; bool b[10005]; void dfs(int i){ for(int j=1; j<=n; 阅读全文
posted @ 2023-08-03 11:04 竹余居居居居居 阅读(39) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; int n,m; int x,y,ru[1005]; queue<int> q; bool l[1005][1005]; vector<int>g[1005]; bool ans1; int a[1005][1 阅读全文
posted @ 2023-08-02 17:03 竹余居居居居居 阅读(41) 评论(0) 推荐(0)
摘要: 找路径 #include<bits/stdc++.h> using namespace std; bool pp=false; int n,m; int a[1005][2],w[1005][1005]; bool d[1005]; int b[1005][1005]; int k[10005],x 阅读全文
posted @ 2023-08-02 10:42 竹余居居居居居 阅读(26) 评论(0) 推荐(0)
摘要: 1213 八皇后问题 http://ybt.ssoier.cn:8088/problem_show.php?pid=1213 #include<bits/stdc++.h> using namespace std; int a[10][10],s=0; bool b[1000], c[1000],d 阅读全文
posted @ 2023-08-02 10:41 竹余居居居居居 阅读(21) 评论(0) 推荐(0)
摘要: 广度优先搜索(Breadth-First Search,BFS)是一种图遍历算法,用于在图或树数据结构中进行搜索。它从起始节点开始,逐层地遍历节点,先访问离起始节点最近的节点,然后再访离起始节点更远的节点。具体来说,广度优先搜索通过使用一个队列来实现,它按照先进先出的顺序存储待访问的节点。 算从起始 阅读全文
posted @ 2023-08-02 10:41 竹余居居居居居 阅读(82) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; bool pp=false; int n,m,wn; int a[105][2],w[1005][1005]; bool d[20]; int b[105][105]; vector<int> g[15]; i 阅读全文
posted @ 2023-08-01 17:03 竹余居居居居居 阅读(206) 评论(0) 推荐(0)
摘要: 图的存储和遍历 #include<bits/stdc++.h> using namespace std; int n; int a[15][15]; bool d[20]; bool b[20]; vector<int> g[15]; void dfs(int i){ d[i]=true; cout 阅读全文
posted @ 2023-08-01 15:01 竹余居居居居居 阅读(119) 评论(0) 推荐(0)
摘要: 边表邻接矩阵 #include<bits/stdc++.h> using namespace std; int n,m; int v1,v2; int a[105][105]; int main(){ cin>>n>>m; for(int i=1; i<=m; i++){ cin>>v1>>v2; 阅读全文
posted @ 2023-07-24 11:00 竹余居居居居居 阅读(50) 评论(1) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; int m,k; int nx,ny; queue<int> q1; int vis[100005]; string path[10000]; string p1= "DABC"; int main(){ me 阅读全文
posted @ 2023-07-23 15:54 竹余居居居居居 阅读(21) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h>using namespace std; int m,k;int nx,ny;queue<int> q1;int vis[100005];string path[10000];string p1= "DABC"; int main(){ memset(v 阅读全文
posted @ 2023-07-23 15:52 竹余居居居居居 阅读(573) 评论(0) 推荐(0)