int consecutiveNumbersSum(int N) { int ans = 0; for (int i = 1; N > 0; N-=i, i++) ans += (N % i == 0); return ans; }
Code over!
int consecutiveNumbersSum(int N) { int ans = 0; for (int i = 1; N > 0; N-=i, i++) ans += (N % i == 0); return ans; }
Code over!