hdu 1159 Common Subsequence
来源:互联网 发布:java虚拟机怎么安装 编辑:程序博客网 时间:2024/05/29 19:59
hdu 1159 Common Subsequence
史上最经典的 dp 要把它吃透
#include <iostream>#include<cstdio>#include<cstring>#include<cmath>char a[1000],b[1000];int c[1000][1000],lena,lenb,i,j;using namespace std;int main(){ while(scanf("%s%s",a,b)!=EOF) { lena=strlen(a);lenb=strlen(b); memset(c,0,sizeof(c)); for(i=0;i<lena;i++) { for(j=0;j<lenb;j++) { if(a[i]==b[j]) c[i+1][j+1]=c[i][j]+1; else c[i+1][j+1]=max(c[i][j+1],c[i+1][j]); } } printf("%d\n",c[lena][lenb]); } return 0;}
0 0
- hdu 1159 Common Subsequence
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- Common Subsequence hdu 1159
- HDU 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- HDU 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- hdu 1159 Common Subsequence
- Redis学习笔记(3)
- HDU 5396 Expression (区间dp)
- openOffice的使用
- Marlin固件之二:源代码详解与移植
- 二叉排序树转化为排序的双向链表
- hdu 1159 Common Subsequence
- Java深度历险(八)Java I/O
- 24 - Swap Nodes in Pairs
- HDU 2444 (二分图判定+最大匹配)
- hdu 2566 放大的X
- 架构里没有大写的“I”
- oracle存储过程--在应用程序中访问存储过程程序完整举例
- hdu 5400 Arithmetic Sequence(水题一道)
- UVA 11019 Matrix Matcher