码迷,mamicode.com
首页 >  
搜索关键字:dfs    ( 10564个结果
zoj 3817 Chinese Knot(hash+暴力)
题目链接:zoj 3817 Chinese Knot 题目大意:给出四个字符串,对应着同心结的四条边,现在给定一个目标串,可以从任意节点开始移动,问是否可以匹配目标串。 解题思路:用hash将四个字符串的正序和逆序处理出来,然后dfs枚举,每次保留起始位置和移动方向即可。 #include #include #include #include using namespace...
分类:其他好文   时间:2014-09-10 21:10:11    阅读次数:363
print all unique solution to split number n
print all unique solution to split number n, given choice of 1 3 5 10for example if n is 4{1, 1, 1, 1}{1, 3}思路:用DFS肯定可以求解,但需要遍历所有可能,进行剪纸之后用递推实现。主要剪枝思想...
分类:其他好文   时间:2014-09-10 19:27:20    阅读次数:144
uva705 - Slash Maze 【转化+dfs】
题目:uva705 - Slash Maze  题意:给出一个迷宫,看题目给出的图就知道,由 \ 和 / 组成,让你求有几个环,然后最大的环由几个矩形组成。 分析:这是一道很灵活的题目,关键在于对题目给出图形的转化,例如‘ \ ’ 可以转化为 1 0 0 0 1 0 0 0 1 而‘ / ' 可以转化为 0 0 1 0 1 0 1 0 0 然后直接广搜或者深搜都...
分类:其他好文   时间:2014-09-10 17:53:20    阅读次数:146
POJ 3411 Paid Roads
题目来源:http://poj.org/problem?id=3411 Paid Roads Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5383   Accepted: 1923 Description A network of m ro...
分类:其他好文   时间:2014-09-10 17:47:00    阅读次数:220
Leetcode dfs Construct Binary Tree from Preorder and Inorder Traversal
Construct Binary Tree from Preorder and Inorder Traversal  Total Accepted: 14824 Total Submissions: 55882My Submissions Given preorder and inorder traversal of a tree, construct the binary...
分类:其他好文   时间:2014-09-10 14:16:11    阅读次数:158
BFS HDU 1175
,水题啊。开始的时候还以为很难的。看了题解发现好多人都是用DFS。我是用BFS 的,跟1728比较像。 思路就是。一个方向搜到底。但是要注意的是有棋子的地方是不能经过的。   代码虐我千百遍,我待代码如初恋         连连看 Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja...
分类:其他好文   时间:2014-09-10 10:52:20    阅读次数:208
Leetcode dfs N-Queens
N-Queens  Total Accepted: 14054 Total Submissions: 54127My Submissions The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other...
分类:其他好文   时间:2014-09-10 09:39:00    阅读次数:272
Leetcode dfs N-Queens II
N-Queens II  Total Accepted: 12668 Total Submissions: 38109My Submissions Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct...
分类:其他好文   时间:2014-09-10 09:38:20    阅读次数:218
Leetcode dfs Path SumII
Path Sum II  Total Accepted: 18489 Total Submissions: 68323My Submissions Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For exampl...
分类:其他好文   时间:2014-09-10 01:38:49    阅读次数:223
Leetcode dfs Word Break II
Word Break II  Total Accepted: 15138 Total Submissions: 92228My Submissions Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a va...
分类:其他好文   时间:2014-09-10 00:30:09    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!