Pro.ID22533 TitleTrees Made to Order Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22533 AC0 Submit0 Ratio- 时间&空间限制描述We can number binary trees using the following scheme:
The first 10 binary trees and tree number 20 in this sequence are shown below: Your job for this problem is to output a binary tree when given its order number. 输入Input consists of multiple problem instances. Each instance consists of a single integer n, where 1 ≤ n ≤ 500,000,000. A value of n = 0 terminates input. (Note that this means you will never have to output the empty tree.) 输出Description We can number binary trees using the following scheme:
The first 10 binary trees and tree number 20 in this sequence are shown below: Your job for this problem is to output a binary tree when given its order number. Input Input consists of multiple problem instances. Each instance consists of a single integer n, where 1 ≤ n ≤ 500,000,000. A value of n = 0 terminates input. (Note that this means you will never have to output the empty tree.) Output For each problem instance, you should output one line containing the tree corresponding to the order number for that instance. To print out the tree, use the following scheme:
-- If L is empty, just output X(R'). Sample Input 1 Sample Output X Source 样例输入1 样例输出X 作者 |