随笔分类 - 搜索~DFS&BFS
HDU 2586 How far away(dfs+邻接表)
摘要:How far away 【题目链接】 " How far away " 【题目类型】 dfs+邻接表 &题意: 题目大意:一个村子里有n个房子,这n个房子用n 1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的距离是多少。 &题解: 我以为是LCA的题,但dfs居然也能过,感觉是数据有
阅读全文
Codeforces Round #381 (Div. 2)D. Alyona and a tree(树+二分+dfs)
摘要:D. Alyona and a tree Problem Description: Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an posi
阅读全文
Codeforces Round #381 (Div. 2)A. Alyona and copybooks(dfs)
摘要:A. Alyona and copybooks Problem Description: Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to
阅读全文
UVa 297 Quadtrees(树的递归)
摘要:Quadtrees 四分树就是一颗一个结点只有4个儿子或者没有儿子的树 【题目链接】 " UVa 297 Quadtrees " 【题目类型】树的递归 &题意: 一个图片,像素是32\ 32,给你两个先序递归的字符串,要你把他俩合起来输出面积。p代表结点,f代表黑色,e代表白色。 &题解: 用字符串
阅读全文
Codeforces Round #368 (Div. 2) D. Persistent Bookcase
摘要:Persistent Bookcase Problem Description: Recently in school Alina has learned what are the persistent data structures: they are data structures that a
阅读全文
POJ 3984 迷宫问题(BFS)
摘要:迷宫问题 迷宫问题 迷宫问题 迷宫问题 Description 定义一个二维数组: 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, }; 它表示一个迷宫,其中的
阅读全文
HDU 2717 Catch That Cow(BFS)
摘要:Catch That Cow Farmer 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
阅读全文
浙公网安备 33010602011771号