#K46332. Christmas Tree Generator
Christmas Tree Generator
Christmas Tree Generator
You are given an integer T representing the number of test cases. For each test case, you are given an integer h indicating the height of a Christmas tree. Your task is to print a symmetric Christmas tree of height h using asterisk characters (*
) aligned in the center.
The number of stars in the i-th row (0-indexed) is given by the formula: \( 2 \times i + 1 \). Each row should be centered within a width of \(2 \times h - 1\) characters. When there are multiple test cases, the trees should be printed one after the other, separated by a blank line.
Example:
Input: 2 3 5Output: *
*
inputFormat
The first line contains a single integer T denoting the number of test cases. The following line contains T integers, each representing the height of a Christmas tree.
outputFormat
For each test case, output the Christmas tree pattern corresponding to its height. Each tree should be centered within a width of \(2h-1\) characters, and consecutive trees must be separated by an empty line.
## sample1
3
*
*****
</p>