UVA 10066 The Twin Towers
来源:互联网 发布:linux vnc地址 编辑:程序博客网 时间:2024/05/21 10:52
DP,题目很长,题意就是求LCS。
#include<cstdio>#include<cstring>#include<string>#include<queue>#include<algorithm>#include<map>#include<stack>#include<iostream>#include<list>#include<set>#include<vector>#include<cmath>#define INF 0x7fffffff#define eps 1e-8#define LL long long#define PI 3.141592654#define CLR(a,b) memset(a,b,sizeof(a))#define FOR(i,a,n) for(int i= a;i< n ;i++)#define FOR0(i,a,b) for(int i=a;i>=b;i--)#define pb push_back#define mp make_pair#define ft first#define sd second#define sf scanf#define pf printf#define acfun std::ios::sync_with_stdio(false)#define SIZE 100+1using namespace std;int a[SIZE],b[SIZE],dp[SIZE][SIZE];int main(){ int la,lb; int ca=1; while(~sf("%d%d",&la,&lb),la||lb) { FOR(i,0,la) sf("%d",&a[i]); FOR(i,0,lb) sf("%d",&b[i]); CLR(dp,0); FOR(i,0,la) FOR(j,0,lb) { if(a[i]==b[j]) dp[i+1][j+1]=dp[i][j]+1; else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]); } pf("Twin Towers #%d\n",ca++); pf("Number of Tiles : %d\n\n",dp[la][lb]); }}
0 0
- UVA 10066 - The Twin Towers
- uva 10066 The Twin Towers
- UVA 10066 The Twin Towers
- UVA 10066 The Twin Towers
- UVa 10066 - The Twin Towers
- UVa 10066 - The Twin Towers
- UVa 10066 - The Twin Towers
- UVa 10066 - The Twin Towers
- Uva-10066-The Twin Towers
- UVa:10066 The Twin Towers
- UVa 10066: The Twin Towers
- UVA - 10066 The Twin Towers
- UVa 10066 - The Twin Towers
- UVa 10066 - The Twin Towers
- uva 10066 The Twin Towers
- UVA 10066 - The Twin Towers
- UVA - 10066 The Twin Towers
- UVA 10066 The Twin Towers
- “官员不作为”在向谁撒娇?
- 肉鸡的维护
- 删除数据库中重复数据的方法。
- “山巅一寺一壶酒”——圆周率的谐音记忆法
- 在ubuntu中配置SSH(解决connect to host localhost port 22: Connection refused问题)
- UVA 10066 The Twin Towers
- 最适合和孩子一起看的100部BBC经典纪录片
- cocos2dx3.2学习之路之锚点
- EBS OAF开发中部署OAF项目
- 键盘字符16进制码表,字符八进制 十进制 十六进制 对照表
- 扩展Js startWith函数,类似Java中的startsWith
- GDI+在内存中绘图
- ElasticSearch 简单入门
- Web Office Apps 按照微软官方的例子部署后 仅能预览 excel 其他格式全都无法预览