摘要: 题目链接:http://poj.org/problem?id=1056思路分析:检测某字符串是否为另一字符串的前缀,数据很弱,可以使用暴力解法。这里为了练习KMP算法使用了KMP算法。代码如下:#include using namespace std;const int N = 10;const i... 阅读全文
posted @ 2014-10-24 22:40 Leptus 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1664思路分析:数据较小,考虑深度优先搜索搜索解空间。代码如下:#include using namespace std;int M, N, Count = 0;void dfs( int deep, int x, int put ){... 阅读全文
posted @ 2014-10-24 21:44 Leptus 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1298思路分析:水题,字符偏移求解,注意字符串输入问题即可。代码如下:#include #include using namespace std;const int MAX_N = 200 + 10;char A[MAX_N];int ... 阅读全文
posted @ 2014-10-24 20:52 Leptus 阅读(196) 评论(0) 推荐(0) 编辑