https://leetcode.com/problems/consecutive-numbers-sum/description/
class Solution {
public:
int consecutiveNumbersSum(int N) {
int cnt = 0;
for(int i=1; i<=N; i++){
int a = i*(i-1)/2;
if(a>=N) break;
int num = N-a;
if(num%i==0) cnt+=1;
}
return cnt;
}
};