1090: [SCOI2003]字符串折叠 (区间动态规划)
来源:互联网 发布:foxbot编程序软件 编辑:程序博客网 时间:2024/05/29 19:01
#include<iostream>#include<cstring>#include<cstdio>#define inf 0x7fffffffusing namespace std;char s[101];int n,f[101][101];bool mark[101][101];inline bool jud(int l,int r,int cl,int cr){if((r-l+1)%(cr-cl+1)!=0)return 0; for(int i=l;i<=r;i++) if(s[i]!=s[(i-l)%(cr-cl+1)+cl])return 0; return 1;}int get(int x){int t=0;while(x){x/=10;t++;}return t;}inline int dp(int l,int r){if(l==r)return 1;if(mark[l][r])return f[l][r];mark[l][r]=1;int t=r-l+1;for(int i=l;i<r;++i){t=min(t,dp(l,i)+dp(i+1,r));if(jud(i+1,r,l,i)) t=min(t,dp(l,i)+2+get((r-i)/(i-l+1)+1)); }return f[l][r]=t;}int main(){scanf("%s",s);n=strlen(s)-1;printf("%d",dp(0,n));return 0;}
0 0
- 1090: [SCOI2003]字符串折叠 (区间动态规划)
- BZOJ 1090: [SCOI2003]字符串折叠|动态规划
- BZOJ 1090 SCOI2003 字符串折叠 动态规划+Hash
- BZOJ 1090 [SCOI2003]字符串折叠 区间DP
- 1090: [SCOI2003]字符串折叠 区间DP
- 【bzoj 1090】[SCOI2003]字符串折叠 区间dp
- [BZOJ]1090: [SCOI2003]字符串折叠 区间DP
- 1090: [SCOI2003]字符串折叠
- BZOJ 1090: [SCOI2003]字符串折叠 区间动归
- 【BZOJ1090】[SCOI2003]字符串折叠【区间DP】
- BZOJ1090: [SCOI2003]字符串折叠 区间DP
- 【BZOJ1090】【SCOI2003】字符串折叠 {区间dp}
- BZOJ1090(SCOI2003)[字符串折叠]--区间DP
- BZOJ 1090: [SCOI2003]字符串折叠
- 【BZOJ 1090】 [SCOI2003]字符串折叠
- bzoj 1090 [SCOI2003]字符串折叠
- 【BZOJ 1090】[SCOI2003]字符串折叠
- BZOJ系列1090《[SCOI2003]字符串折叠》题解
- 《Thinking in Java》狗血的学习笔记-3初始化
- Java 线程与并发研究系列三(join()方法使用)
- ZOJ-1374
- java利用爬虫技术抓取(省、市(区号\邮编)、县)数据
- 开源编程框架
- 1090: [SCOI2003]字符串折叠 (区间动态规划)
- bzoj1821 [JSOI2010]Group 部落划分 Group
- input的width和size同时存在问题
- NYOJ 1021 Fibonacci Again
- android 如何同时检测移动 长按事件
- 计算机编码字符小结(ascii,unicode,utf-8)
- Openstack前传六(KVM初探)
- Unity引擎初探
- 短小精悍的宏(整理篇)