HDU1868:Consecutive sum
来源:互联网 发布:java ffmpeg log 编辑:程序博客网 时间:2024/05/01 05:26
Problem Description
Every body knew that 15 = 1+2+3+4+5 = 4+5+6 = 7+8. Now give you a number N, tell me how many ways to represent N as a sum of consecutive positive integers. For example, 15 have 3 ways to be found.
Input
Each line will contain an signed 32-bits integer N. Process to end of file.
Output
For each case, output the answer in one line.
Sample Input
151050
Sample Output
311
#include <iostream>using namespace std;int main(){ int n,i,j; while(cin >> n) { j = 0; if(n%2) j = j+1; for(i = 2; i*i<=n; i++) { if(n%i == 0) { if(i%2!=0) j = j+1; if(n/i%2!=0) j = j+1; } } cout << j << endl; } return 0;}
- HDU1868:Consecutive sum
- HDU1868 Consecutive sum【数学计算+枚举】
- hdu1868
- HDU1977:Consecutive sum II
- Consecutive sum II 1977
- Sum of Consecutive Primes
- hdu 1868 Consecutive sum
- Consecutive sum II 1977
- Sum of Consecutive Primes
- HDOJ1977 Consecutive sum II
- Sum of Consecutive Prime Numbers
- 1259. Sum of Consecutive Primes
- Sum of Consecutive Prime Numbers
- Sum of Consecutive Prime Numbers
- Sum of Consecutive Prime Numbers
- nyoj-879-Consecutive sum II
- Sum of Consecutive Prime Numbers
- Sum of Consecutive Prime Numbers
- struts2配置详解
- 【C语言】输入任意多个整数的小技巧
- VC++编译选项详解
- Android五个进程等级
- 修作玉颜色,卖于帝王家(java笔试面试—-求职经历)
- HDU1868:Consecutive sum
- oracle xe快捷版本介绍
- 自用数据库软件(3-3程序执行前后db变化比较)
- pat 1004 counting Leaves
- linux之Centos5中基于nginx的简单负载均衡
- QuickFix user define msg
- 虚拟机安装linux Centosd 过程
- QX项目实战-16.ActiveMQ消息服务部署和维护说明
- Oracle 11g R2 安装图文攻略