![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
专题一 简单搜索
九羽-
日有所进,月有所变,终有所成。
展开
-
E - Counting Cliques ( DFS找 k大的完全子图 )
E - Counting Cliques ( DFS找 k大的完全子图 )A clique is a complete graph, in which there is an edge between every pair of the vertices. Given a graph with N vertices and M edges, your task is to count th...原创 2019-10-19 21:14:14 · 792 阅读 · 0 评论 -
Comunicating the Tibet(dfs染色)
Comunicating the Tibet(dfs染色)题目链接:https://cn.vjudge.net/problem/1040907/originThe Himalayas form the highest mountain range in the world (with mountains as high as 7,200 meters). Located in Asia...原创 2019-08-19 22:00:07 · 197 阅读 · 0 评论 -
B - Interesting Vertices ( DFS回溯 )
B - Interesting Vertices ( DFS应用 )题目大意:给你一课有n个节点的树,其中有k个节点被染色,求有多少个节点满足自身没有被染色并且它的每棵子树中都至少有一个节点被染色。解题思路:dfsdfs回溯类似求树的重心的方式求解,dfs回溯可以得到每个节点的它的子树中是否都有染色的点并统计所有子树中染色点的个数sum,然后走向父亲的那棵子树中被染色的点数...原创 2019-10-18 21:08:20 · 278 阅读 · 0 评论 -
F - Forest Program( DFS找环的个数和长度 )
F - Forest Program( DFS找环的个数和长度 )The kingdom of Z is fighting against desertification these years since there are plenty of deserts in its wide and huge territory. The deserts are too arid to have...翻译 2019-10-13 21:25:48 · 994 阅读 · 0 评论 -
G - Shuffle'm Up POJ - 3087(string+BFS模拟题意)
G - Shuffle’m Up POJ - 3087A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, eac...原创 2019-05-28 19:26:32 · 285 阅读 · 0 评论 -
K - 迷宫问题 POJ - 3984 (bfs的回溯)
K - 迷宫问题 POJ - 3984定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。In...原创 2019-05-28 19:48:39 · 176 阅读 · 0 评论 -
L - Oil Deposits HDU - 1241(BFS求连通分量)
L - Oil Deposits HDU - 1241The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and ...原创 2019-05-28 20:32:58 · 173 阅读 · 0 评论 -
D. Lunar New Year and a Wander ( DFS )
D. Lunar New Year and a Wander ( DFS )Lunar New Year is approaching, and Bob decides to take a wander in a nearby park.The park can be represented as a connected graph withnnnodes andmmbidir...原创 2019-07-29 09:02:49 · 174 阅读 · 0 评论 -
鬼吹灯之牧野诡事(四维bfs)
鬼吹灯之牧野诡事Problem Description蓝色空间号和万有引力号进入了四维水洼,发现了四维物体–魔戒。这里我们把飞船和魔戒都抽象为四维空间中的一个点,分别标为 “S” 和 “E”。空间中可能存在障碍物,标为 “#”,其他为可以通过的位置。现在他们想要尽快到达魔戒进行探索,你能帮他们算出最小时间是最少吗?我们认为飞船每秒只能沿某个坐标轴方向移动一个单位,且不能越出四维空间。...原创 2019-05-17 20:15:40 · 288 阅读 · 0 评论 -
H - Pots POJ - 3414(倒水问题+BFS回溯)
H - Pots POJ - 3414You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(...原创 2019-05-30 21:28:19 · 383 阅读 · 0 评论 -
M - 非常可乐 HDU - 1495(BFS模拟题意,倒水问题)
M - 非常可乐 HDU - 1495大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都...原创 2019-05-30 19:37:15 · 415 阅读 · 0 评论 -
棋盘问题(DFS)
棋盘问题 POJ - 1321在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <...原创 2019-05-20 20:58:27 · 466 阅读 · 0 评论 -
B - Dungeon Master(经典三维BFS)
B - Dungeon Master POJ - 2251You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minu...原创 2019-05-20 21:51:54 · 233 阅读 · 0 评论 -
E - Find The Multiple POJ - 1426(DFS枚举二进制数)
E - Find The MultipleGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not gr...原创 2019-05-24 19:17:19 · 159 阅读 · 0 评论 -
F - Prime Path POJ - 3126(36种情况的进阶BFS)
F - Prime Path POJ - 3126The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offi...原创 2019-05-24 20:42:45 · 318 阅读 · 0 评论 -
C - Catch That Cow(经典二维BFS)
C - Catch That Cow POJ - 3278Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the co...原创 2019-05-21 18:59:22 · 232 阅读 · 0 评论 -
I - Fire Game FZU - 2150(多起点BFS)
I - Fire Game FZU - 2150Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or jus...原创 2019-05-25 21:03:12 · 405 阅读 · 0 评论 -
J - Fire! UVA - 11624(多起点BFS+两次BFS)
J - Fire! UVA - 11624Joe works in a maze. Unfortunately, portions of the maze havecaught on fire, and the owner of the maze neglected to create a fireescape plan. Help Joe escape the maze.Given ...转载 2019-05-26 21:10:39 · 491 阅读 · 0 评论 -
N - Find a way HDU - 2612(两次BFS)
N - Find a way HDU - 2612Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Y...原创 2019-05-30 18:58:51 · 183 阅读 · 0 评论 -
Find a way
Find a wayPass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home ...原创 2019-04-13 20:34:27 · 148 阅读 · 0 评论