uva 10405 Longest Common Subsequence
2023-03-14 10:17:27 时间
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char str1[1002],str2[1002]; int d[1002][1002]; int main() { while(gets(str1) && gets(str2)) { int len1=strlen(str1),len2=strlen(str2); memset(d,0,sizeof(d)); for(int i=1; i<=len1; ++i) for(int j=1; j<=len2; ++j) { if(str1[i-1]==str2[j-1]) d[i][j]=d[i-1][j-1]+1; else d[i][j]=max(d[i-1][j],d[i][j-1]); } printf("%d\n",d[len1][len2]); } return 0; }
模板:
相关文章
- Amazon 将亮相 CES 2020 – 连接性与移动性
- 2019 年十大 AWS 开源博客文章
- 2019 年 AWS 开源博客回顾
- 利用 Direct Connect Gateway 和 Transit Gateway 打造跨国企业网络环境
- 利用 Transit Gateway 和 Fortigate 实现企业东西向和南北向流量安全控制
- 在 re:Invent 2019 大会上庆祝 AWS 社区领袖
- AWS re:Invent 2019 回顾:新发布的 APN 合作伙伴计划与更新
- 将存储过程迁移到 Amazon Redshift
- 如何在 AWS 中国区上基于 EC 2搭建 Kubernetes
- 使用 AWS Step Functions 和 AWS Glue 编排基于 Amazon Redshift 的 ETL 工作流
- 利用 Redshift 控制台简化 Amazon Redshift 集群的管理
- 利用 Active Directory 联合身份访问基于 Amazon Elasticsearch Service 的 Kibana
- 使用 AWS CloudFormation 自动创建 Amazon Redshift 集群
- python openpyxl基本操作
- 回顾第三部分 – 2019 年 re:Invent 大会上的开源
- 授予对 Amazon Redshift 管理控制台的细粒度访问权限
- Amazon EC2 高内存实例运行 SAP HANA: 简单,灵活,性能强大
- python-web框架 fastapi
- 使用 AWS Backup 来进行备份生命周期的集中管理
- 回顾第二部分 – 2019 年 re:Invent 大会上的开源