摘要: Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one t 阅读全文
posted @ 2021-05-17 20:37 keiiha 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。 图1 图2 现给定两棵树,请你判断它们是否是同构的。 输入格式: 输入给出2棵 阅读全文
posted @ 2021-05-17 17:17 keiiha 阅读(59) 评论(0) 推荐(0) 编辑
摘要: Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given s 阅读全文
posted @ 2021-05-17 11:25 keiiha 阅读(91) 评论(0) 推荐(0) 编辑