又一道lcs,不多说,本blog有大量lcs题目解释
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;#define MAXN    100+10int first[MAXN], second[MAXN], dp[MAXN][MAXN];int dynamic_programming(const int &len_first, const int &len_second)
{memset(dp, 0, sizeof(dp));for(int i = 1; i <= len_first; i ++) {for(int j = 1; j <= len_second; j ++) {if( first[i] == second[j] ) {dp[i][j] = dp[i-1][j-1]+1; continue;}dp[i][j] = max(dp[i][j-1], dp[i-1][j]);}}return dp[len_first][len_second];
}int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGEfreopen("test.in", "r", stdin);
#endifint len_first, len_second, cas(1);while( scanf("%d %d", &len_first, &len_second) ) {if( !len_first && !len_second ) {break;}for(int i = 1; i <= len_first; i ++) {scanf("%d", &first[i]);}for(int i = 1; i <= len_second; i ++) {scanf("%d", &second[i]);}printf("Twin Towers #%d\n", cas ++);printf("Number of Tiles : %d\n\n", dynamic_programming(len_first, len_second));}return 0;
}

uva_10066 The Twin Towers相关推荐

  1. UVa 10066 - The Twin Towers(LCS水题)

    题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&am ...

  2. UVa 10192 - Vacation amp; UVa 10066 The Twin Towers ( LCS 最长公共子串)

    链接:UVa 10192 题意:给定两个字符串.求最长公共子串的长度 思路:这个是最长公共子串的直接应用 #include<stdio.h> #include<string.h> ...

  3. UVA10066 - The Twin Towers

    思路:最长公共子序列 #include <iostream> #include <cstdio> #include <cstring> #include <a ...

  4. UVa 10066 Twin Towers (DP 最长公共子序列)

    题意  求两串数字最长公共子序列的长度 裸的lcs没啥说的 #include<cstdio> #include<cstring> #include<algorithm&g ...

  5. 世界摩天大楼2009年排名

    2009年世界摩天大楼 (高度单位:米 M) 排名 国家 城市 中名 英名 高度 楼层 年份 状态 1 阿联酋 迪拜 Al Burj 1200 200 2010 在建 2 阿联酋 迪拜 迪拜塔 Bur ...

  6. python plt pyplot matplotlib绘图时形状异常

    问题 如图,绘制的饼图和条形图叠加了,但是又不彻底. 原因 绘制过程中我前面绘制了很多图,添加了很多参数,共同作用下导致此问题的出现. 解决 使用plt.close()关掉绘图重新绘制即可. prin ...

  7. 世界顶级音效公司_世界顶级游戏开发公司

    世界顶级音效公司 The game industry is growing, especially among small, independent development companies. If ...

  8. A Game of Thrones(49)

    30.EDDARD(0) I stood last vigil for him myself," Ser Barristan Selmy said as they looked down a ...

  9. A Game of Thrones(46)

    28.CATELYN(0) My lady, you ought cover your head," Ser Rodrik told her as their horses plodded ...

  10. 提取了下刘汝佳推荐的题号...

    今天闲来没事上uva oj提取了下刘汝佳推荐的acm题号,原始数据如下: Volume 0. Getting Started    10055 - Hashmat the Brave Warrior ...

最新文章

  1. 【Java】枚举(enum)机制 详解
  2. 大数据加入渗透实体,错过它你将错过一个时代!
  3. 《流浪地球》是一部违反科学常识的大烂片
  4. Artificial Intelligence and Change Management
  5. 参考例子,学习FuncT, TResult委托
  6. 韵镖侠登录不上 显示无法连接到服务器,什么是韵镖侠?韵镖侠是做什么的?...
  7. WinStore开发知识导航集锦
  8. 行星齿轮设计_精密行星减速机的作用、分类及应用领域和特点
  9. 遍历结果集java_java – 循环遍历while循环后如何将结果集重置为第一行
  10. python中的tuple_Python中的tuple元组详细介绍
  11. 在PaddlePaddle框架下通过两层全连接网络实现IRIS数据分类
  12. 使用ViewPager + Fragment实现微信底部Tab效果
  13. 昌邑机器人_昌邑四轴CNC加工齿模长沙四轴CNC加工精鑫精密
  14. 5.软件架构设计:大型网站技术架构与业务架构融合之道 --- 网络
  15. macOS 常用键盘快捷键大全
  16. 3dmax寻找丢失贴图_寻找遗失的号码
  17. css绘制一个动态雷达图
  18. 数字图像处理实验八--图像分割
  19. 苹果微信分身版ios_香草直播苹果版下载-香草直播ios苹果版「精彩直播」
  20. 讲座:与迷茫为友的成长(贺利坚老师,烟台大学)——完整讲座PPT,精彩与动画媲美

热门文章

  1. 四川公办二本计算机专业院校排名,四川二本大学排名及分数线
  2. PHPStorm长时间Updating Indices
  3. 水木周平戏说中国网络黑幽默!
  4. ROS学习:launch文件编写
  5. 复合函数高阶求导公式_复合函数求导公式大全 大学复合函数求导法则
  6. 科技传播杂志科技传播杂志社科技传播编辑部2022年第9期目录
  7. 创建个人网站(一) 如何申请一个网站
  8. 个人网站如何申请支付接口?(教程)
  9. js QQ音乐歌词显示在浏览器标题
  10. 制造业数字化转型存在哪些问题