Solution of ZOJ 2095 Divisor Summation (Online Version)
来源:互联网 发布:韩国软件限制怎么办 编辑:程序博客网 时间:2024/06/09 14:26
Give a natural number n (1 <= n <= 500000), please tell the summation of all its proper divisors.
Definition: A proper divisor of a natural number is the divisor that is strictly less than the number.
e.g. number 20 has 5 proper divisors: 1, 2, 4, 5, 10, and the divisor summation is: 1 + 2 + 4 + 5 + 10 = 22.
Input
An integer stating the number of test cases, and that many lines follow each containing one integer between 1 and 500000.
Output
One integer each line: the divisor summation of the integer given respectively.
Sample Input
3
2
10
20
Sample Output
1
8
22
Source: ZOJ Monthly, March 2004
分析:此题关键点在I/O部分,如果是用C++标准库中的cin和cout对象,则将超时。网上提供的大部分算法都是基于查表的方法,这里给出一个我实现的可Accept的online算法,所占内存只需188KB。
- Solution of ZOJ 2095 Divisor Summation (Online Version)
- ZOJ 2095 Divisor Summation
- ZOJ Problem Set - 2095 Divisor Summation
- ZOJ 2095 Divisor Summation (求因子和)
- zoj 2095.Divisor Summation
- Divisor Summation
- Divisor Summation约数之和
- SPOJ DIVSUM Divisor Summation
- SPOJ DIVSUM Divisor Summation
- Divisor Summation(与求约数个数类似)
- zoj 1007 Numerical Summation of a Series
- zoj 1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- ZOJ 1007 Numerical Summation of a Series
- ZOJ 1007Numerical Summation of a Series
- ZOJ--1007:Numerical Summation of a Series
- UVa Problem Solution: 10168 - Summation of Four Primes
- socket缓存大小
- 文本文件与二进制文件区别
- 求人帮我将一个java程序 改为 C语言的~
- hdu 1800 map水过
- what互联网产品
- Solution of ZOJ 2095 Divisor Summation (Online Version)
- zoj 1295 python
- zoj 1025 python
- 时分秒针重合问题
- 为什么C++还没能取代C?
- 母函数详解【转】
- left,right,inner join有什么区别?
- 如何在ASP程序创建自己的在线编辑器FCKeditor(转载)
- 从网看到的,下来自己仔细看看,异常处理