poj 3267
来源:互联网 发布:程序员入门书籍 编辑:程序博客网 时间:2024/06/05 20:17
还是没能自己独立做出来,dp还需要练
代码如下
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;int main(){char a[605][27];char b[305];int w,l;scanf("%d%d",&w,&l);scanf("%s",&b);for(int i=0;i<w;i++)scanf("%s",a[i]);int dp[305];memset(dp,0,sizeof(dp));for(int i=l-1;i>=0;i--){dp[i]=dp[i+1]+1;for(int j=0;j<w;j++){int len=strlen(a[j]);if(l-i>=len&&a[j][0]==b[i]){int pm=i,pd=0;while(pm<l){if(a[j][pd]==b[pm++]){pd++; }if(pd==len){dp[i]=min(dp[i],dp[pm]+pm-i-len);break;}}}}}printf("%d\n",dp[0]); }
阅读全文
0 0
- POJ 3267
- POJ 3267
- poj.3267
- poj-3267
- poj 3267
- POJ 3267 动态规划
- poj 3267 动态规划
- poj 3267 动态规划
- poj 3267(dp)
- POJ 3267 (DP)
- poj 3267 简单dp
- POJ-3267(DP)
- POJ 3267 DP
- poj 3267 dp
- POJ 3267 java实现
- POJ
- poj
- POJ
- 一些优秀的网站(持续更新)
- 文件链接命令
- 【STL】容器 > 顺序容器 > string 容器
- python 面向对象 关于init方法和del方法
- jsp。8.26总结(附导入jstl标签库)
- poj 3267
- 简单知识——跨页面信息传递
- 深入理解红黑树
- erewrwerwer
- 我值多少钱
- (CSU
- [Sdoi2016]排列计数
- Faster R-CNN学习笔记
- python easygui