Description 判断一个图是否为一个边通图 Input n 顶点 (n<=100) 边 Output 1 表示连通 0 表示不边通 Sample Input 5 1 2 2 3 5 4 0 0 Sample Output 0 思路: 从第一个点开始遍历整张图,看看能不能遍历到n个点,可以输出1,否侧输出0。 代码部分: #include<iostream> #include<cstdio> using namespace std; bool g[101