判断二叉数的相似的遍历的问题,要求使用C语言的程序的设计的办法的解决的过程怎么做

Problem Description
Everyone konws how to traveling a tree using the DFS strategy. But we also know that there are many ways to do so. For example, giving a tree as the following picture, we may get three ways: 010011, 001101, 01010011. 0 stands for the down operation while 1 means the up operation.
Now we make a constraint: if one node has k direct childs, you can visit a node at most 2*k times, if k == 0, you can visit it only once, in the example, the root has two direct child. Like the example, you can only get two ways: 010011, 001101. Because the way 01010011 will visit the node in yellow four times.
Here is the problem: ACboy drawed a tree, but is not very nice, so he won't show you the picture. Instread he will give you two strings indicating that the ways to travel the tree. Of cource, the strings will only contain 0 and 1. And your mission is to tell whether ACboy is telling the truth. For example, he drawed a picture as the following, if he give you 010011 and 001101, then he is telling the truth, but if he give you 010011 and 01010011, you konw that he is telling a lie.

Input
On the first line of input is a single positive integer n, telling the number of test scenarios to follow.Each test case consists of two lines, each containing a string of the characters '0' and '1' of length at most 3000, both describing a way to travel the tree.

Output
For each test case output a line containing the word "True" or the word "False", depending on whether ACboy is telling the truth.

Sample Input
2
010011
001101
010011
01010011

Sample Output
True
False

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

0
使用Hausdorff距离计算轨迹相似度
1
Matlab 问题怎么显示以下代码中识别图片的相似度
0
关于二叉树的路径的相似行的判断的问题,如何使用C语言解决啊
3
MySQL在hive使用的过程中的作用是什么?
0
KSVD程序中要求信号Y的列数要大于字典D的列数,不知道为什么有这个要求。
0
分型二叉树的相似性的判断算法,如何利用C语言编程技术的实现的
0
数字的相似性的判断的原理的使用,怎么利用C语言程序设计的办法实现的呢
0
相等性和相似性的判断的算法,如何才能利用C程序的编写的技术来实现的呢
1
如何利用余弦相似度进行聚类
1
C#如何将textbox里输入的值存到double数组里
1
求个大佬帮忙解释一下这个链接是怎么构成的怎么做的,想做个相似的
0
相似性的判断算法,输出相似性判定,怎么采用C语言的程序的代码编写的方式来实现的
1
C#随机数数组排序问题,代码错在哪里?
1
点击EditText,出现W/IInputConnectionWrapper:finishingComposingText on inactive InputConnection
1
基于内容的推荐算法的Java源码。
0
同一个存储过程,在不同数据库(环境相似)中执行时报错
1
C++服务端开发是不是应该减少使用虚函数?
1
JVAV写贪吃蛇小游戏,用线程实现窗口重绘,然后用键盘指令改变小蛇的方向,请问怎么让小蛇只根据指令移动?
0
NLP 文本相似度匹配应如何设计流程
0
相似性的判断的算法,怎么判断图的节点上的相似性用C语言的程序的代码设计的程序怎么实现