2011年8月17日

DFS解决POJ 1979

摘要: DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles.Write a program to count the num 阅读全文

posted @ 2011-08-17 22:43 飞-虎 阅读(239) 评论(0) 推荐(0) 编辑

BFS解决POJ 2243

摘要: DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard exactly once. He thinks that the most difficult part of the problem is determining the 阅读全文

posted @ 2011-08-17 22:41 飞-虎 阅读(648) 评论(0) 推荐(0) 编辑

STL之stack——解决POJ 1028

摘要: DescributionStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this.T 阅读全文

posted @ 2011-08-17 21:54 飞-虎 阅读(981) 评论(0) 推荐(0) 编辑

导航