经典动态规划
现在对动态规划的子结构划分和子结构的理解,转移方程还没有明确的认识
Zipper
Time Limit:1000MS |
|
Memory Limit:65536K |
Total Submissions:9409 |
|
Accepted:3218 |
Description
Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must stay in its 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 the two 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 of input contains a single positive integer from 1 through 1000. It represents the number 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 a single 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 first two strings. The first two strings will have lengths between 1 and 200 characters, 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 the sample 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
///
分享到:
相关推荐
北大POJ1016-Numbers That Count【字符串处理】 解题报告+AC代码
LeetCode判断字符串是否循环 :bookmark_tabs:Plan 动态规划 背包问题 动态规划 POJ 3267 POJ 1260 POJ 1015 POJ 3176 POJ 1080 POJ 1159 POJ 2533 POJ 1836 Leetcode 70 Leetcode 309 搜索 DFS POJ 2488 POJ 3083 ...
poj 2653 计算几何算法初步模板,判断两直线是否相交。
POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类
组合数学 ACM 和,POJ里用到组合数学的题目
上面可能有poj的题目,hdu的题目,spoj的题目,sgu的题目,hust上的题目,fzu上的题目
poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题...
1.文章统计2.特殊要求字符串3.删除字符4.字符串比较5. 字符串排序6.字符串逆序7分离单词8.字符串复制9.字符串替换11.//字符串左右中12.The Clock13.Coin Test 14.Music Composer
poj分类poj分类poj分类poj分类
北大POJ2002-Squares 解题报告+AC代码
在进行ACM编程训练时做字符串专题的一些题目(POJ1782,POJ1790,POJ1951,POJ2003,POJ2121)
POJ第1861题源码 POJ第1861题源码 POJ第1861题源码
poj 1012解题报告poj 1012解题报告poj 1012解题报告poj 1012解题报告
poj 2329解题报告poj 2329解题报告poj 2329解题报告poj 2329解题报告
poj 1659解题报告poj 1659解题报告poj 1659解题报告poj 1659解题报告
poj 3414解题报告poj 3414解题报告poj 3414解题报告poj 3414解题报告
简单地poj1001代码,是典型的利用数组输出结果的方法,关键的是测试数据。
poj 百练 题目分类 poj 百练 题目分类
北大POJ1159-Palindrome 解题报告+AC代码
北大poj AC源码1600个(C或C++)