829. Consecutive Numbers Sum
k
總和
x
組合
class Solution:
def consecutiveNumbersSum(self, n: int) -> int:
ans = 0
constant = 0
divisor = 1
while constant < n:
if ((n - constant) / divisor).is_integer():
ans += 1
constant = constant + divisor
divisor += 1
return ansLast updated