摘要:
题意:问母串中至少去掉多少个字母才能是刚好由单词表中的一些单词连接而成的。分析:dp,f[i]表示母串从第i位起始的后缀所对应的最少去掉字母数。f[i]有两种选择f[i + 1] + 1或者f[i + num] + num - strlen(word[j])。其中num是从第i位开始匹配word[j]所需要的母串从i位起始的后缀的前缀的长度。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#de 阅读全文
posted @ 2011-07-02 12:55
undefined2024
阅读(1002)
评论(1)
推荐(1)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int n, m, a[10], la, ans;bool reject;bool split[10], ansplit[10];void work(){ la = 0; while (n > 0) { a[la] = n % 10; n /= 10; la++; } for (int i = 0; i < la / 2; i+ 阅读全文
posted @ 2011-07-02 09:55
undefined2024
阅读(381)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 105struct Node{ int va, vb, step, pre, opr;} q[maxn * maxn];int a, b, c, l, r;bool vis[maxn][maxn];int stk[maxn * maxn], top;void make(int va, int vb, int opr 阅读全文
posted @ 2011-07-02 08:57
undefined2024
阅读(162)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 105struct Node{ int va, vb, step, pre, opr;} q[maxn * maxn];int a, b, c, l, r;bool vis[maxn][maxn];int stk[maxn * maxn], top;void make(int va, int vb, int opr 阅读全文
posted @ 2011-07-02 08:42
undefined2024
阅读(124)
评论(0)
推荐(0)

浙公网安备 33010602011771号