#K65887. Consecutive Sum Representations

    ID: 32297 Type: Default 1000ms 256MiB

Consecutive Sum Representations

Consecutive Sum Representations

Given a positive integer \(n\), your task is to determine the number of ways \(n\) can be expressed as a sum of consecutive positive integers.

Specifically, find the number of solutions \((a, L)\) in positive integers \(a\) and \(L\) (with \(L \ge 1\)) such that

\[ n = a + (a+1) + \cdots + (a+L-1) = La + \frac{L(L-1)}{2} \]

Note that the trivial representation of \(n = n\) is always counted as one valid way.

inputFormat

The input is read from standard input (stdin) and consists of multiple test cases. The first line contains an integer \(T\) (the number of test cases). Each of the next \(T\) lines contains a single positive integer \(n\) (\(1 \le n \le 10^9\)).

outputFormat

For each test case, output a single integer on a new line representing the number of ways \(n\) can be expressed as a sum of consecutive positive integers. The output should be written to standard output (stdout).

## sample
5
15
10
1
9
8
4

2 1 3 1

</p>