Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:WA 的朋友,可以看看叶子节点判断是否正确In Reply To:WA 的朋友,可以看看叶子节点判断是否正确 Posted by:zhangfeifei at 2010-08-06 20:26:07 > 注意判断叶子节点,两棵空树是不是同一个节点的子树。这样才能准确判断叶子节点。 > !lChild && !rChild && high==rHigh 高度相同的连续两棵空树,对应的父节点一定是叶子节点,而高度不同的连续两棵空树却不能找到叶子节点。 > input: > 22 (5(4(11(7()())(2()()))()) (8(13()())(4()(1()())))) > 20 (5(4(11(7()())(2()()))()) (8(13()())(4()(1()())))) > 10 (3 > (2 (4 () () ) > (8 () () ) ) > (1 (6 () () ) > (4 () () ) ) ) > 0 () > -6 (3(-9()())()) > 9 (5(4(3(2()())())())()) > output: > yes > no > yes > no > yes > no 太感谢你第六组数据了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator