摘要: Description Given a code (not optimized), and necessary inputs, you have to find the output of the code for the inputs. The code is as follows: int a, b, c, d, e, f;int fn( int n ) { if( ... 阅读全文
posted @ 2014-05-05 21:15 t-tay-y 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整... 阅读全文
posted @ 2014-05-05 21:02 t-tay-y 阅读(359) 评论(0) 推荐(0) 编辑
摘要: BFS广度优先搜寻迷宫最短路径。 /* Sample Input: 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 Sample Output: (0, 0) (1, 0) (2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (3 阅读全文
posted @ 2014-04-10 23:32 t-tay-y 阅读(184) 评论(0) 推荐(0) 编辑