dfs
追什么风筝
这个作者很懒,什么都没留下…
展开
-
红色警报
L2-013. 红色警报时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越战争中保持各个城市间的连通性非常重要。本题要求你编写一个报警程序,当失去一个城市导致国家被分裂为多个无法连通的区域时,就发出红色警报。注意:若该国本来就不完全连通,是分裂的k个区域,而失去一个城市并不改变其他城市之间的连通性,则不要发出警报。输入格式:输入在第一行给出两个整数...原创 2018-03-31 23:35:48 · 206 阅读 · 0 评论 -
BFS和DFS算法原理
通俗易懂的解释啊转载 2018-04-01 00:29:35 · 327 阅读 · 0 评论 -
2097网络寻路
Problem A: 网络寻路Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 36 Solved: 21[Submit][Status][Web Board]DescriptionX 国的一个网络使用若干条线路连接若干个节点。节点间的通信是双向的。某重要数据包,为了安全起见,必须恰好被转发两次到达目的地。该包可能在任意一个节点产生,我们需要知道该网络...原创 2018-04-10 18:11:02 · 108 阅读 · 0 评论 -
Prime Ring Problem
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Not...原创 2018-04-13 15:55:21 · 74 阅读 · 0 评论 -
zcmu-2137 和为T
2137: 和为TTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 71 Solved: 15[Submit][Status][Web Board]Description从一个大小为n的整数集中选取一些元素,使得它们的和等于给定的值T。每个元素限选一次,不能一个都不选。Input 第一行一个正整数n,表示整数集内元素的个数。第二行n个整数,用空格隔开...原创 2018-05-24 16:05:10 · 173 阅读 · 0 评论 -
Image Compression
题目 题目大意:有w*w的棋盘,每个方格为1(黑色)或0(白色),若棋盘的黑色格子数目c1(或白色格子c0)占总格子数的比例>=t;将所有格子都变为黑色(白色),否则,将棋盘均分为四个部分,继续进行上述判断; 思路:简单的dfs; #include<cstdio> #include<algorithm> #include<iostream> usi...原创 2018-08-11 11:18:50 · 185 阅读 · 0 评论 -
Tragedy Words
As is known to all, Wells doesn't have a good command of English. As a result, some unfamiliar words, which may cause sadness of Wells, is called tragedy words. In more detail, a word will be defined ...原创 2018-08-17 16:42:15 · 120 阅读 · 0 评论 -
PAT甲级-1053 Path of Equal Weight (dfs)
1053 Path of Equal Weight (30 分) Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights o...原创 2018-11-17 21:05:16 · 152 阅读 · 0 评论 -
图dfs和bfs时的时间复杂度
下图摘自严蔚敏的教材: dfs: bfs:转载 2018-11-17 21:19:55 · 3238 阅读 · 0 评论