#C10784. Soldiers in Parade
Soldiers in Parade
Soldiers in Parade
You are given t test cases. For each test case, you are given an integer n representing the number of rows in a parade formation. The total number of soldiers in the first n rows is the sum of the first n natural numbers, which can be calculated using the formula:
\( S = \frac{n(n+1)}{2} \)
The number of soldiers required for the next row is simply n + 1. Your task is to compute these two values for each test case and output them.
inputFormat
The first line of input contains a single integer t (1 ≤ t ≤ 105), representing the number of test cases. Each of the next t lines contains a single integer n (1 ≤ n ≤ 109) that specifies the number of rows.
outputFormat
For each test case, output two space-separated integers on a new line. The first integer is the total number of soldiers in the first n rows, computed as \( \frac{n(n+1)}{2} \), and the second integer is the number of soldiers required for the next row (n+1).
## sample1
1
1 2
</p>