上一页 1 ··· 18 19 20 21 22
摘要: 模拟类DescriptionThis problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.  Inputaccording to output of problem ... 阅读全文
posted @ 2009-09-29 03:33 Weiyu Wang 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 模拟类DescriptionYour task is to read a picture of a chessboard position and print it in the chess notation. InputThe input consists of an ASCII-art picture of a chessboard with chess pieces on posi... 阅读全文
posted @ 2009-09-29 01:56 Weiyu Wang 阅读(583) 评论(0) 推荐(0) 编辑
摘要: 模拟类DescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N nort... 阅读全文
posted @ 2009-09-29 00:42 Weiyu Wang 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 模拟类DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, ... 阅读全文
posted @ 2009-09-28 23:28 Weiyu Wang 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 模拟类DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses bef... 阅读全文
posted @ 2009-09-28 12:00 Weiyu Wang 阅读(557) 评论(0) 推荐(0) 编辑
摘要: 输入字符串为二叉树的先根遍历(Pre-order string),可采用堆栈或者递归。一般pre-order 字符串计算使用递归, post-order 字符串计算使用堆栈DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the p... 阅读全文
posted @ 2009-09-28 03:29 Weiyu Wang 阅读(849) 评论(0) 推荐(0) 编辑
摘要: 一共四种可能的情况1) 4s +  d  〉0,ssssdssssdss2)3s + 2d 〉 0,sssddsssddss3)2s + 3d 〉 0,ssdddssdddss4)1s + 4d 〉 0,sddddsddddsd并且对于给定的s和d, year sum: 1)〉 2) 〉 3) 〉 4)DescriptionAccounting for Computer Mac... 阅读全文
posted @ 2009-09-28 00:18 Weiyu Wang 阅读(425) 评论(0) 推荐(0) 编辑
摘要: 贪心算法的基本要素1.贪心选择性质       所谓贪心选择性质是指所求问题的整体最优解可以通过一系列局部最优的选择,即贪心选择来达到。这是贪心算法可行的第一个基本要素,也是贪心算法与动态规划算法的主要区别。在动态规划算法中,每步所作的选择往往依赖于相关子问题的解。因而只有在解出相关子问题后,才能作出选择。而在贪心算法中,仅在当前状态下作出最好选择,即局部最优选择。然... 阅读全文
posted @ 2009-09-27 13:57 Weiyu Wang 阅读(633) 评论(0) 推荐(0) 编辑
摘要: POJ 2965, The Pilots Brothers' refrigeratorPOJ 1753, Flip Game这两道题类似,可转化图论的最短路径问题:顶点(Vertex)数:65536边(Edge)数:65536 * 16 / 2边的权值(Weight):1对于给定两个点, 求最短路径:由于边的权值均为1, 所以适宜采用BFS + Mark Table, 时间复杂度为O(N), N为... 阅读全文
posted @ 2009-09-27 10:24 Weiyu Wang 阅读(592) 评论(0) 推荐(0) 编辑
摘要: POJ 2965, The Pilots Brothers' refrigeratorPOJ 1753, Flip Game这两道题类似,可转化图论的最短路径问题:顶点(Vertex)数:65536边(Edge)数:65536 * 16 / 2边的权值(Weight):1对于给定两个点, 求最短路径:由于边的权值均为1, 所以适宜采用BFS + Mark Table, 时间复杂度为O(N), N为... 阅读全文
posted @ 2009-09-26 13:11 Weiyu Wang 阅读(634) 评论(0) 推荐(1) 编辑
上一页 1 ··· 18 19 20 21 22