POJ-2192
来源:互联网 发布:芒果网络考试系统 3.9 编辑:程序博客网 时间:2024/05/16 09:17
//我刚开始以为好难,其实就是一个DFS,必须记录走过的路径。用一个vis[max][max],数组标记走没走过,走过就是1,没走过就是0.这是关键。
AC代码:
#include<stdio.h>#include<string.h>#define N 1005char a[N];char b[N];char c[N];int vis[N][N];int ok;int L;void dfs(int x,int y,int z){ if(ok==1||z==L) { ok=1; return; } if(vis[x][y]!=0) 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); } return;}int main(){ int x; scanf("%d",&x); int cnt=1; while(x--) { memset(vis,0,sizeof(vis)); scanf("%s%s%s",a,b,c); ok=0; L=strlen(c); dfs(0,0,0); if(ok) { printf("Data set %d: yes\n",cnt++); } else { printf("Data set %d: no\n",cnt++); } } return 0;}
0 0
- poj 2192
- poj 2192
- poj 2192
- POJ 2192
- POJ 2192
- POJ-2192
- POJ 2192
- POJ 2192
- POJ 2192 Zipper
- poj 2192 Zipper
- poj 2192 Zipper DP
- Poj 2192 Zipper
- poj 2192 DFS+剪枝
- DFS poj 2192 zipper
- DP poj 2192
- poj 2192 dp
- poj 2192 字符串匹配
- poj 2192 zipper
- DataGridView控件中的“玄机”
- String字符串使用方法简单测试
- 关注他人感受
- iOS前期OC训练OC_02可见度,方法
- git常用的一些命令总结
- POJ-2192
- Node:区间DP-1
- 习题3-2 分子量(Molar Mass)
- html常用的标签
- #笔记#圣思园 JavaWeb 第42讲——Listener监听器,观察者模式
- python 使用mechanize进行web网页交互
- TCP粘包问题的分析与解决
- UVa400 按列输出
- 编程日记-20150716