#C9021. Consecutive Sum Representations
Consecutive Sum Representations
Consecutive Sum Representations
Given a positive integer (n), determine the number of ways to express (n) as a sum of two or more consecutive positive integers.
For example, when (n=15), it can be expressed as:
1 + 2 + 3 + 4 + 5,
4 + 5 + 6, and
7 + 8.
Your task is to print the count of such representations.
The mathematical condition used is that for a sequence of (k) consecutive numbers starting from (a), the sum is given by (n = k a + \frac{k(k-1)}{2}), and hence (n - \frac{k(k-1)}{2}) must be divisible by (k).
inputFormat
A single line containing one positive integer (n) ((1 \le n \le 10^{12})). Input is given via standard input (stdin).
outputFormat
Output a single integer representing the number of ways to express (n) as the sum of two or more consecutive positive integers. The output is printed to standard output (stdout).## sample
15
3