bfs
David-Wei
这个作者很懒,什么都没留下…
展开
-
hdu 1885 Key Task(bfs+状态压缩)
Problem Description The Czech Technical University is rather old — you already know that it celebrates 300 years of its existence in 2007. Some of the university buildings are old as well. And the na原创 2013-08-10 22:15:11 · 448 阅读 · 0 评论 -
hdu 1429 胜利大逃亡(续) (bfs+状态压缩)
Problem Description Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)…… 这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一个坐标走到相邻四个坐标中的其中一个。魔王原创 2013-08-10 21:42:22 · 562 阅读 · 0 评论 -
Minimum Depth of Binary Tree
class Solution { public: int minDepth(TreeNode* root) { int res=0; bool flag = false; queue q; TreeNode *t; if (root == NULL) return 0; q.push(root); q.push(NULL); while (q.front() != NULL)原创 2017-11-16 09:57:42 · 134 阅读 · 0 评论