Submit | All submissions | Best solutions | Back to list |
DIVSUM - Divisor Summation |
Given a natural number n (1 <= n <= 500000), please output 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 (equal to about 200000), and that many lines follow, each containing one integer between 1 and 500000 inclusive.
Output
One integer each line: the divisor summation of the integer given respectively.
Example
Sample Input: 3 2 10 20 Sample Output: 1 8 22
Warning: large Input/Output data, be careful with certain languages
Added by: | Neal Zane |
Date: | 2004-06-10 |
Time limit: | 3s |
Source limit: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Neal Zane |
hide comments
|
||||||||||||||
2015-02-22 22:25:53 Abhinandan Agarwal
Small puny mistakes willl take me down someday ... |
||||||||||||||
2015-02-21 15:03:21 Mahesh Kohli
should the answer be 0 for n=1? |
||||||||||||||
2015-02-17 16:14:46 sarvagya
time limit exceeded :( |
||||||||||||||
2015-02-11 07:44:32 Himanshu
make your own power function. the pow function in maths library rounds down when converting to integer. eg pow(5,2) will be returned as 24. |
||||||||||||||
2015-01-18 12:58:49 Phạm Bãng Bãng
n <= 100000 and AC :D --Francky--> (Shocked) It's true and we have too n<33333 !!! Last edit: 2015-01-18 13:32:40 |
||||||||||||||
2014-11-27 02:01:41 Minsuk Kim
Python 2.7 novice here - keep on getting time limit exceeded although my code works perfectly fine. I have tried many test cases... --ans(Francky)--> It's not easy with Python, you can see there's few AC with Python. With cube cluster, now, it's easier than with Pyramid as the time limit is more relax. Last edit: 2014-11-27 02:18:55 |
||||||||||||||
2014-10-24 06:28:21 Vikas
Solved in just 0.24s. Nice Problem . |
||||||||||||||
2014-10-08 14:08:14 mehmetin
Can the time limit be reduced for problems that have been changed to cube cluster? For this problem, it could be 1s or 0.5 s. |
||||||||||||||
2014-10-07 13:59:34 Mitch Schwartz
:( I wrote to an admin about the mass change of many problems from Pyramid to Cube, it's very worrying. The current Python results for this problem are also curious, with high memory and 0.00s time. I checked that psyco isn't available. There might be some bug there. Last edit: 2014-10-07 14:49:21 |
||||||||||||||
2014-08-01 10:17:37 Ujjwal Kumar Singh
he guys i am a newbie here i know just basic c++ things getting SIGSEGV error on spoj however code working fine in codeblocks application helpp plz <snip> Last edit: 2023-03-08 17:56:08 |