码迷,mamicode.com
首页 >  
搜索关键字:DFS Troubleshooting    ( 10753个结果
HDU-2821-Pusher(DFS)
Problem Description PusherBoy is an online game http://www.hacker.org/push . There is an R * C grid, and there are piles of blocks on some positions. The goal is to clear the blocks by pushing into t...
分类:其他好文   时间:2014-08-02 23:27:34    阅读次数:342
Codeforces 453C Little Pony and Summer Sun Celebration dfs树上构造
题目链接:点击打开链接 题意: 给定一个无向图 任选一个起点,使得访问每个点的次数奇偶与最后一行的输入一致 思路: 选一个奇数点作为起点 dfs树一下,若子节点不满足则先走到子节点再回来 如此就能保证所有子节点合法 这样dfs结束后最多只有根节点不满足,随便找一个与根相连的点调整一下。 #include #include #include #include #includ...
分类:其他好文   时间:2014-08-02 21:02:49    阅读次数:433
hdu 1501 Zipper (dfs+记忆化搜索)
Zipper Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6491    Accepted Submission(s): 2341 Problem Description Given three strings...
分类:其他好文   时间:2014-08-02 21:01:44    阅读次数:297
Unique Paths
问题:从起点到终点总共有多少条路径分析:f[x,y]=f[x+1,y]+f[x,y+1],用记忆化搜索就可以解决了class Solution {public: int num[110][110]; int dfs(int m,int n,int x,int y) { ...
分类:其他好文   时间:2014-08-02 20:39:33    阅读次数:165
Minimum Depth of Binary Tree
题意:二叉树的最小深度注意 1.当root为空的时候直接返回0,因为MIN赋值很大,所以如果不单独预判的话会返回MIN 2.判断树的深度应该到叶子节点,也就是左右子结点都为空的那个结点 3.树的深度的根节点深度为1class Solution {public: void dfs(...
分类:其他好文   时间:2014-08-02 20:39:13    阅读次数:233
hdu3861The King’s Problem (强连通 缩点+最小路径覆盖)
The King’s Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1606 Accepted Submission(s): 584 Problem Description In the Kingdom of ...
分类:其他好文   时间:2014-08-02 18:31:33    阅读次数:252
hdu 1518 Square (dfs搜索可参考poj1011)
Square Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8589    Accepted Submission(s): 2784 Problem Description Given a set of sti...
分类:其他好文   时间:2014-08-02 18:29:23    阅读次数:286
SPOJ MYQ10 10649. Mirror Number (数位dp)
SPOJ MYQ10 10649. Mirror Number (数位dp) ACM 题目地址:SPOJ MYQ10 Mirror Number 题意:  求[a,b]中镜像回文的个数。  0 分析:  看到题目和数据范围就知道是数位dp了。  很明显镜像回文只有0,1,8,跟回文的一题一样,在dfs的时候得开个辅助数组记录前面已经选择的数字。  注意还得去掉前...
分类:其他好文   时间:2014-08-02 18:27:13    阅读次数:242
UVA 11488 - Hyper Prefix Sets(Trie)
UVA 11488 - Hyper Prefix Sets 题目链接 题意:给一些01串,定义一个P(s)表示:拥有相同长度前缀的字符串个数 * 该前缀长度,求最大的P(S) 思路:Trie,建好Trie树后dfs一遍记录答案最大值 代码: #include #include #include using namespace std; const int SI...
分类:其他好文   时间:2014-08-02 18:25:04    阅读次数:202
Climbing Stairs
问题:上楼每次能走一步或两步,有多少种走法class Solution {public: int a[1000]; int dfs(int n) { if(n<0) return 0; if(n==0) return 1; if(a[n])...
分类:其他好文   时间:2014-08-02 18:19:03    阅读次数:140
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!