POJ 2230
来源:互联网 发布:知乎怎么查看我的收藏 编辑:程序博客网 时间:2024/06/08 00:34
#include<iostream>using namespace std;int u[100000+1];int v[100000+1];int next[100000+1];int pnt[10000+1];int visit[100000+1];int n,m,e;void add(int a, int b){ //建造邻接表u[++e] = a, v[e] = b;next[e] = pnt[a]; pnt[a] = e;}void dfs(int root){//是根据图的边来建造图,visit是确认边是否经边一次;int i;for(i = pnt[root]; i!=0; i = next[i]){if(!visit[i]){visit[i] = true;dfs(v[i]);}}printf("%d\n",root);}int main(){scanf("%d %d",&n,&m);int a,b;for(int i = 0; i < m; ++i){scanf("%d %d",&a,&b);add(a, b);add(b, a);}dfs(1);}
阅读全文
0 0
- poj 2230
- poj-2230
- poj 2230
- poj 2230
- POJ 2230
- POJ 2230 Watchcow
- poj 2230 Watchcow
- POJ-2230-Watchcow
- poj 2230 Watchcow
- POJ 2230 Watchcow
- poj 2230 DFS
- poj 2230 Watchcow
- POJ 2230 DFS
- POJ - 2230 Watchcow
- poj 2230详解
- POJ 2230 Watchcow
- poj 2230 Watchcow
- poj 2230 Watchcow
- Windows编程一日一练(1)
- http错误代码含义
- 基于angular的退出全屏,全屏显示以及关闭系统
- JDK的下载安装与配置全局环境变量
- C#技巧【调用线程无法访问此对象,因为另一个线程拥有该对象的问题的解决办法】
- POJ 2230
- ABBYY FineReader 14检测不到条形码怎么办?
- aop:aspectj-autoproxy 标签解析
- 给字符串对象定义一个repeat功能。当传入一个整数n时,它会返回重复n次字符串的结果。
- dts从uboot加载到kernel使用案例的分析
- db2
- 1.桶排序
- windows编程一日一练(2)
- Python中的file(上)