#K72237. Consecutive Sum Representations
Consecutive Sum Representations
Consecutive Sum Representations
Given a positive integer N, determine the number of unique ways to represent N as a sum of two or more consecutive positive integers.
For example, when N = 15, there are three ways to express it: 1 + 2 + 3 + 4 + 5, 4 + 5 + 6, and 7 + 8.
The minimal sum of k+1 consecutive numbers starting from 1 is given by the formula: \(\frac{k(k+1)}{2}\). Use this idea to determine if a sequence of consecutive numbers can sum to N.
Your program should read input from standard input and write the answer to standard output.
inputFormat
The input consists of a single line containing a positive integer N (1 ≤ N ≤ 109).
outputFormat
Output a single integer representing the number of unique ways to represent N as a sum of consecutive positive integers.
## sample15
3