摘要: 解题报告:1、subproblems:2、A(n) = A(n-2) + 2 * B(n-1)3、B(n) = A(n-1) + D(n-1)4、D(n) = B(n-1)4、由此可得:A(n) = A(n-2) + 2 * B(n-1)A(n) = 3*A(n-2) + 2 * B(n-3)A(n... 阅读全文
posted @ 2014-11-05 14:33 颜威 阅读(212) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 2. Data Structures::Binary Trees解题报告:1、题目太长了,差点失去耐心。:)2、其实无非就是顺着树走,找到叶子的值,不要被那个函数迷惑。3、往左走为0,... 阅读全文
posted @ 2014-10-23 13:24 颜威 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 解题报告:1、逐行放置,则仅需考虑列是否冲突。2、注意在出口处恢复被修改的值。AC代码:#include #include using namespace std;int n, k, ans;int col[10];char chess[10][10];void dfs(int row, int n... 阅读全文
posted @ 2014-10-18 20:22 颜威 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 解题报告:1、DFS遍历,并且记录走过的路径(先数字代替),不重复地全部走完。2、需要按照字典序输出,注意方向数组的方向顺序,并且从A1开始搜索。3、DFS的参数用于记录状态转移量(x,y)和递归的深度(step)。4、使用全局变量简化程序的设计。AC代码:#include #include #de... 阅读全文
posted @ 2014-10-15 21:46 颜威 阅读(245) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 1. Elementary Problem Solving::String// 409 - Excuses, Excuses!#include #include #include in... 阅读全文
posted @ 2014-09-28 15:42 颜威 阅读(189) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 5. Dynamic Programming// 674 - Coin Change#include #include #define MAXN 7500using namespace... 阅读全文
posted @ 2014-09-27 12:28 颜威 阅读(120) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 4. Algorithm Design// 10763 - Foreign Exchange#include #define MAXN 500000using namespace st... 阅读全文
posted @ 2014-09-25 17:09 颜威 阅读(173) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 4. Algorithm Design// 10714 - Ants#include #include using namespace std;int a[1000001];int m... 阅读全文
posted @ 2014-09-25 00:05 颜威 阅读(143) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 4. Algorithm Design// 10341 - Solve It#include #include #define EPS 1e-7 // 精度要求苛刻...in... 阅读全文
posted @ 2014-09-24 22:54 颜威 阅读(127) 评论(0) 推荐(0) 编辑
摘要: AOAPC I: Beginning Algorithm Contests (Rujia Liu)::Volume 2. Data Structures::Lists// 133 - The Dole Queue#include #include typedef struct node{ int n... 阅读全文
posted @ 2014-09-18 10:19 颜威 阅读(157) 评论(0) 推荐(0) 编辑