
DFS
文章平均质量分 79
i-unique
擅长各种姿势划水
展开
-
POJ 1111 Image Perimeters(dfs+求连通块的周长)
Technicians in a pathology lab analyze digitized images of slides. Objects on a slide are selected for analysis by a mouse click on the object. The perimeter of the boundary of an object is one useful measure. Your task is to determine this perimeter for s原创 2017-08-15 19:36:18 · 459 阅读 · 0 评论 -
HDU 2266 How Many Equations Can You Find (技巧性dfs)
Now give you an string which only contains 0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9.You are asked to add the sign ‘+’ or ’-’ between the characters. Just like give you a string “12345”, you can work out a string “123+4-5”. Now give you an integer N, please tell me how原创 2017-07-01 19:09:35 · 319 阅读 · 0 评论 -
HDU 2488 A Knight's Journey(dfs)
The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a kni原创 2017-08-17 19:42:56 · 346 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 H. Skiing(记忆化dfs)
In this winter holiday, Bob has a plan for skiing at the mountain resort.This ski resort has MM different ski paths and NNdifferent flags situated at those turning points.The ii-th path from the S_iSi -th flag to the T_iTi -th flag has length原创 2017-09-09 16:59:16 · 525 阅读 · 0 评论 -
HDU 5547 Sudoku(dfs+模拟+状态判断)
Yi Sima was one of the best counselors of Cao Cao. He likes to play a funny game himself. It looks like the modern Sudoku, but smaller. Actually, Yi Sima was playing it different. First of all, he tried to generate a 4×44×4 board with every row contains原创 2017-09-19 21:18:38 · 385 阅读 · 0 评论 -
CodeForces 337D Book of Evil(双向dfs)
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connects some pair of原创 2017-10-29 19:44:14 · 398 阅读 · 0 评论 -
Codeforces 143A Help Vasilisa the Wise 2(暴力)
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open i原创 2017-11-27 22:41:04 · 455 阅读 · 0 评论 -
Codeforces 193A. Cutting Figure(dfs)
You've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares原创 2018-01-02 22:18:40 · 468 阅读 · 0 评论 -
CodeForces 198B Jumping on Walls(dfs)
Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that原创 2018-01-04 22:04:25 · 414 阅读 · 0 评论 -
HDU 1258 Sum It Up (dfs+去重)
Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], then there are four different sums that equal 4: 4,3+1,2+2, and 2+1+1.(A numbe原创 2017-07-01 19:23:22 · 332 阅读 · 0 评论 -
POJ 1020 Anniversary Cake(dfs+分割思想)【转】
Nahid Khaleh decides to invite the kids of the “Shahr-e Ghashang” to her wedding anniversary. She wants to prepare a square-shaped chocolate cake with known size. She asks each invited person to determine the size of the piece of cake that he/she wants (wh转载 2017-07-01 19:37:57 · 282 阅读 · 0 评论 -
HDU 1455 Sticks(dfs+强剪枝)
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were originally. Please help hi原创 2017-07-01 19:47:28 · 325 阅读 · 0 评论 -
Codeforces Round #428 (Div. 2) C.Journey(dfs求期望)
C. Journeytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roa原创 2017-08-13 21:18:39 · 406 阅读 · 0 评论 -
POJ 2738 Two Ends(记忆化搜索+dp)
In the two-player game "Two Ends", an even number of cards is laid out in a row. On each card, face up, is written a positive integer. Players take turns removing a card from either end of the row and placing the card in their pile. The player whose cards原创 2017-08-10 21:04:12 · 436 阅读 · 0 评论 -
POJ 2657 Comfort(模拟+dfs)
A game-board consists of N fields placed around a circle. Fields are successively numbered from1 to N clockwise. In some fields there may be obstacles. Player starts on a field marked with number 1. His goal is to reach a given field marked with number Z原创 2017-08-10 20:32:40 · 462 阅读 · 1 评论 -
POJ 2245 Lotto(水水的dfs)
In the German Lotto you have to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn't increase your chance of winning - is to select a subset S containing k (k > 6) of these 49 numbers, and then play several gam原创 2017-08-03 19:04:20 · 348 阅读 · 0 评论 -
POJ 2367 Genealogical tree(拓扑排序+dfs)
The system of Martians' blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Martian can have one parent as well as ten. Nobody will be surprised by a hundred of原创 2017-07-27 18:59:13 · 566 阅读 · 0 评论 -
ZOJ 2103 Marco Popo the Traveler(dfs+欧拉路)
Marco Popo, the famous traveler, is traveling around the country of ACM. There are colored high-ways between cities (of course there is at most one high-way between any two cities), and his goal is to drive along each high-way once and only once. There is原创 2017-07-26 15:19:49 · 527 阅读 · 0 评论 -
POJ 3895 Cycles of Lanes(dfs+模拟)
Each of the M lanes of the Park of Polytechnic University of Bucharest connects two of the N crossroads of the park (labeled from 1 to N). There is no pair of crossroads connected by more than one lane and it is possible to pass from each crossroad to each原创 2017-07-18 17:46:37 · 384 阅读 · 0 评论 -
WUST 1949 家谱树(拓扑排序+dfs)
有个人的家族很大,辈分关系很混乱,请你帮整理一下这种关系。给出每个人的孩子的信息。输出一个序列,使得每个人的后辈都比那个人后列出。原创 2017-07-15 14:11:37 · 613 阅读 · 0 评论 -
游历魔法王国(牛客网 网易2018校招题 图论)
链接:https://www.nowcoder.com/questionTerminal/f58859adc39f4edc9cd8e40ba4160339来源:牛客网魔法王国一共有n个城市,编号为0~n-1号,n个城市之间的道路连接起来恰好构成一棵树。小易现在在0号城市,每次行动小易会从当前所在的城市走到与其相邻的一个城市,小易最多能行动L次。如果小易到达过某个城市就视为小易游历过这个城市...原创 2018-09-10 14:25:07 · 430 阅读 · 0 评论