Zipper记忆化搜索
来源:互联网 发布:七彩网络下载 编辑:程序博客网 时间:2024/06/06 05:01
http://acm.hdu.edu.cn/showproblem.php?pid=1501
#include<iostream>#include<string>
using namespace std;
char a[210],b[210],c[410];
int vis[210][210],k;
void dfs(int x,int y,int z)
{
if(k==1)
return;
if(z==strlen(c))
{
k=1;
return;
}
if(vis[x][y])
return;
vis[x][y]=1;
if(a[x]==c[z])
dfs(x+1,y,z+1);
if(b[y]==c[z])
dfs(x,y+1,z+1);
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a>>b>>c;
memset(vis,0,sizeof(vis));
k=0;
dfs(0,0,0);
cout<<"Data set "<<i<<": ";
if(k==1)
cout<<"yes\n";
else
cout<<"no\n";
}
return 0;
}
0 0
- Zipper记忆化搜索
- hdu 1501 Zipper(记忆化搜索)
- HDU-1501 Zipper DFS+记忆化搜索
- HDOJ 1501 Zipper 记忆化搜索
- 【记忆化搜索】HDU-1501 Zipper
- hdu 1501 Zipper 记忆化搜索
- HDU 1501 Zipper 记忆化搜索
- HDU1501 Zipper(DFS+记忆化搜索)
- hdu1501 zipper【记忆化搜索】【动态规划】
- POJ2192:Zipper(记忆化搜索)
- HDU 1501 & POJ 2192 Zipper(dp记忆化搜索)
- hdu 1501 Zipper (dfs+记忆化搜索)
- POJ 2192 && HDU 1501 Zipper (记忆化搜索)
- hdu 1501 Zipper (记忆优化搜索)
- hdu1501 zipper dfs+记忆话搜索
- PKU2192 Zipper(DP+记忆化)
- HDU 1501 Zipper & ACM俱乐部 2604 单词混合【记忆化搜索】
- 暑期dp46道(26)HDOJ 1501 Zipper dfs+记忆化搜索
- android:dataPath解析
- Mark
- Mark
- JavaScript的事件代理(赞)
- 求两日期之间的相隔天数(year,month,day)
- Zipper记忆化搜索
- Algorithm Gossip: 奇数魔方阵
- iOS 图片存到沙盒
- poj 3274 Gold Balanced Lineup
- codeforces 18B Platforms
- ubuntu中文编码配置
- 安卓实现动态加载class
- sleep,wait和yield的区别
- js的沙箱模式