摘要: 题意:给出 n m 代表第一棵树有 n 个节点 第二棵树有 m 个节点然后接下来 n+m 行给出 a b 表示第 i 个节点的左孩子是 a 右孩子是 b问这两棵树中有多少棵子树是相同的..eg:View Code Sample Input22 2-1 2-1 -12 -1-1 -15 52 34 5-1 -1-1 -1-1 -12 34 5-1 -1-1 -1-1 -1Sample Output111HintThe two trees in the first sample look like this.思路:根据输入的信息建树..用 deg 数组记录这棵树的第 i 个节点有多少棵子树..用 阅读全文
posted @ 2012-09-11 17:16 Griselda. 阅读(1085) 评论(0) 推荐(1)