Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:这题是不是有直接算ROOT值然后COMPARE的方法啊?

Posted by bobten2008 at 2009-11-07 10:51:13 on Problem 1635
In Reply To:这题是不是有直接算ROOT值然后COMPARE的方法啊? Posted by:11119999 at 2009-01-10 13:54:54
我的代码90行,主要是根据输入串建树,然后对树DFS,重新获得一个排序后的01串。
对两个输入串分别运用上述方法分别得到两个排序后的01串,如果两个串相等则same,否则different

关键在于DFS时对子树返回的01串进行存储和排序,然后重组
比如对于0100101100100111和0011000111010101,重组后分别变成:
0001101100101101和0001110011010101,不相等所以输出different

可以去看看我的代码:http://blog.csdn.net/bobten2008/archive/2009/11/07/4781994.aspx



Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator