#include <stdio.h>
#include <string.h>
char a[210],b[210],c[420];
int dfs(int x, int y)
{
if(x==-1&&y==-1)
return 1;
if(x>=0 && a[x]==c[x+y+1])
if(dfs(x-1,y))
return 1;
if(y>=0&&b[y]==c[x+y+1])
if(dfs(x,y-1))
return 1;
return 0;
}
int main()
{
int t,i;
scanf("%d", &t);
for(i=1;i<=t;i++)
{
scanf("%s %s %s", a,b,c);
if (dfs(strlen(a)-1,strlen(b)-1))
printf("Data set %d: yes\n", i);
else
printf("Data set %d: no\n", i);
}
return 0;
}
POJ 2192-zipper(动态规划)
最新推荐文章于 2020-07-12 21:05:55 发布