HDU1501 记忆化搜索
来源:互联网 发布:gal gadot 知乎 编辑:程序博客网 时间:2024/04/29 12:44
Zipper
Time Limit: 2000/1000 MS(Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2108 Accepted Submission(s): 752
Problem Description
Given three strings, you are to determine whether thethird string can be formed by combining the characters in the first twostrings. The first two strings can be mixed arbitrarily, but each must stay inits original order.
For example, consider forming "tcraete" from "cat" and"tree":
String A: cat
String B: tree
String C: tcraete
As you can see, we can form the third string by alternating characters from thetwo strings. As a second example, consider forming "catrtee" from"cat" and "tree":
String A: cat
String B: tree
String C: catrtee
Finally, notice that it is impossible to form "cttaree" from"cat" and "tree".
Input
The first line ofinput contains a single positive integer from 1 through 1000. It represents thenumber of data sets to follow. The processing for each data set is identical.The data sets appear on the following lines, one data set per line.
For each data set, the line of input consists of three strings, separated by asingle space. All strings are composed of upper and lower case letters only.The length of the third string is always the sum of the lengths of the firsttwo strings. The first two strings will have lengths between 1 and 200characters, inclusive.
Output
For each data set, print:
Data set n: yes
if the third string can be formed from the first two, or
Data set n: no
if it cannot. Of course n should be replaced by the data set number. See thesample output below for an example.
Sample Input
3
cat tree tcraete
cat tree catrtee
cat tree cttaree
Sample Output
Data set 1: yes
Data set 2: yes
Data set 3: no
记忆化搜索,一开始没看出来,一直DP搞了好久……
- HDU1501 记忆化搜索
- 记忆化搜索 HDU1501
- hdu1501 记忆化搜索
- HDU1501 Zipper(DFS+记忆化搜索)
- hdu1501 zipper【记忆化搜索】【动态规划】
- hdu1501 zipper dfs+记忆话搜索
- 记忆化搜索例题
- PKU1088---记忆化搜索
- PKU1088 记忆化搜索
- HDU1078 记忆化搜索
- HDU1978 记忆化搜索
- poj1661 记忆化搜索
- zoj1107记忆化搜索
- poj1191(记忆化搜索)
- 滑雪 记忆化搜索
- hdu3779---记忆化搜索
- hdu2452---记忆化搜索
- 【记忆化搜索】滑雪
- 矩阵应用:PCA-Principal Component Analysis
- 7 做最好的自己
- 使用热图标识出重要事情
- 计算机经典书籍总结
- Windows 环境变量列表
- HDU1501 记忆化搜索
- 子衿的事(4)
- switch 语句的参数类型
- Windows系统下MySQL的常用命令解析
- linux install fcitx
- HDU1502 动态规划计数 高精度
- 周五回顾,找到三件做的好以及三件需要改善的事情
- java TimeTask类
- asdf