首页 > 其他 > 详细

[LeetCode] 829. Consecutive Numbers Sum 连续数字之和

时间:2019-09-27 01:13:30      阅读:128      评论:0      收藏:0      [点我收藏+]



Given a positive integer?N, how many ways can we write it as a sum of?consecutive positive integers?

Example 1:

Input: 5
Output: 2
Explanation: 5 = 5 = 2 + 3

Example 2:

Input: 9
Output: 3
Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4

Example 3:

Input: 15
Output: 4
Explanation: 15 = 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5

Note:?1 <= N <= 10 ^ 9.



Github 同步地址:

https://github.com/grandyang/leetcode/issues/829



参考资料:

https://leetcode.com/problems/consecutive-numbers-sum/



LeetCode All in One 题目讲解汇总(持续更新中...)

[LeetCode] 829. Consecutive Numbers Sum 连续数字之和

原文:https://www.cnblogs.com/grandyang/p/11595236.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!