
动态规划
文章平均质量分 80
kelvingu616
这个作者很懒,什么都没留下…
展开
-
ZOJ 1027 Human Gene Functions
典型的DP,跟《算法导论》的最长公共子串很像。第一次有点粗心,两次次提交后AC。#include #define SPACE '-'int GetTableIndex(char c){ switch(c) { case 'A': return 0; case 'C':原创 2012-10-25 10:47:57 · 431 阅读 · 0 评论 -
ZOJ 1147 Formatting Text
又是一题经典的DP,很多小细节要注意,不然就WA了#include #include #include #include using namespace std;int main(){ int width = 0; while (scanf("%d", &width) && width > 0) { getchar();原创 2012-10-27 00:24:36 · 982 阅读 · 0 评论 -
ZOJ 1013 Great Equipment
开始看以为是背包,想了好久,没办法,看了别人的解法才知道不是背包。。最后就是输出的“Case:”,冒号后面竟然还要有个空格,题目也没说,发现ACM的题好多都这样,弄得WA,唉~~#include #include #include using namespace std;#define ITEM_CNT 3#define MAX_AMOUNT 500i原创 2012-10-25 10:44:48 · 1073 阅读 · 0 评论 -
ZOJ 1074 To the Max
最长连续子串和的扩展到二维的情况,同理可以扩展到更多维的情况。#include #include int main(){ int N = 0; scanf("%d", &N); int rect[100][100] = {0}; for (int i = 0; i < N * N; i++) { scanf("%d"原创 2012-10-26 07:50:06 · 472 阅读 · 0 评论