#K54212. Leaf Arrangement Pattern
Leaf Arrangement Pattern
Leaf Arrangement Pattern
This problem requires you to generate a leaf arrangement pattern based on a given positive integer N. The pattern is constructed such that each line i (1-indexed) contains exactly i occurrences of the string O
(with a trailing space) and is preceded by N - i
spaces to ensure the pattern is centrally aligned.
For a given integer N, the output should be a triangle-shaped pattern. For example, if N = 3, the expected output is:
O O O O O O
Multiple test cases will be provided, and for each test case, you should output the corresponding pattern sequentially.
inputFormat
The first line of input contains an integer T, the number of test cases. Each of the following T lines contains one integer N (1 ≤ N ≤ 50).
outputFormat
For each test case, output the pattern corresponding to the integer N. Each line of the pattern should be output on a new line. The patterns for different test cases should be concatenated in the order they are given.
## sample3
1
2
3
O
O
O O
O
O O
O O O
</p>