TopCoder

User's AC Ratio

85.7% (6/7)

Submission's AC Ratio

41.4% (12/29)

Tags

Description

給你節點數n,請參考範例輸出格式畫出一棵具有n個節點的完全二元樹(complete binary tree)。

Input Format

輸入檔可能包含多筆測試資料。每筆測試資料佔一列,包含一個正整數n(1<=n<=63)。
當n=0時代表輸入結束。

Output Format

請參考範例輸出輸出具有n個節點的完全二元樹(complete binary tree)。

請注意不要輸出列末多餘的空白字元!

Sample Input 1

1
3
12
0

Sample Output 1

*
  *
 / \
*   *
           *
          / \
         /   \
        /     \
       /       \
      /         \
     *           *
    / \         / \
   /   \       /   \
  *     *     *     *
 / \   / \   /
*   * *   * *

Hints

Problem Source

原TIOJ1215 / TIOJ 2008例行賽03 (prob G)。Problem Setter:Tmt。

Subtasks

No. Testdata Range Score
1 0 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 262144 1