连通分量
SYaoJun
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1150 Travelling Salesman Problem (25 分)
很繁琐的题目,难其实不难。 #include<bits/stdc++.h> using namespace std; const int maxn=205; const int INF = 0x3fffffff; int G[maxn][maxn]; int in[maxn],arr[maxn]; int opti=0,optd=INF; int main(){ int n,m,u...原创 2019-07-25 08:11:39 · 196 阅读 · 0 评论 -
7-32 哥尼斯堡的“七桥问题” (25 分)
无向图欧拉图的判断 1.连通 2.节点度数为偶数 注意: 如果数据量较大尽量用scanf来读入,不然就是会超时。 #include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <queue&...原创 2019-10-12 14:20:55 · 525 阅读 · 0 评论 -
L2-013 红色警报 (25 分)
考查图的连通分量 先计算最开始的连通分量,然后把输入的这个点标记为访问的点,再统计一遍连通分量 只有当连通分量增加了,说明删除的点才是关键点。每次将前面输入过的点记为标记过的点 注意失去最后一个城市要根据数量判断,而不能直接放在程序的末尾,不然有个测试点会过不去 #include <iostream> #include <algorithm> #include <st...原创 2019-09-07 08:13:13 · 329 阅读 · 0 评论 -
L2-025 分而治之 (25 分)
根据每个节点的度判别连通性 当所有节点的度都小于0时,说明每个节点都孤立了。 因为存在一条边重复删除,所以节点的度有负数的存在。 #include <iostream> #include <algorithm> #include <string> #include <deque> #include <cstring> #include &...原创 2019-09-07 19:28:51 · 396 阅读 · 0 评论
分享