BloombergOA #1
Consecutive Sum (Financial Engineer Intern)
估计中等可在线判题
考点(AI 标注)位运算
Given num, count the distinct ways to write num as a sum of at least two consecutive positive integers.
输入格式
A single integer, 1≤num≤10¹².
输出格式
Output the number of representations.
样例 1
输入:
15
输出:
3
样例 2
输入:
2
输出:
0
样例 3
输入:
9
输出:
2
样例说明
15 has three: 1+2+3+4+5, 4+5+6, 7+8; 2 has none; 9 has two: 2+3+4, 4+5.