CZ_PROB2 - Sum of Factors

no tags 

Find the sum of the factors of a number including 1 and the given number.

Input

Number of test cases T followed by T lines of number n.
0 < T <= 5000
0 < n <= 999999999
Note: The number will not have a very large prime factor.

Output

The sum of the factors for each test case.

Example

Input:
2
6
5

Output:
12
6

hide comments
nadstratosfer: 2018-08-19 08:45:03

Make sure you count sum of divisors, not prime factors. Also, even O(sqrt(n)) will TLE in Python, think of something better; statement contains a hint.

trijeet: 2017-10-28 04:00:16

Weak test cases :') AC in 1 go !

hexa0509: 2017-10-01 14:38:43

why keep getting TLE?

shreeyash: 2016-01-09 22:06:53

TLE

Minsuk Kim: 2014-12-02 02:10:20

oh my goodness keep on getting TLE with python 2.7... :(

CODER: 2014-09-27 16:47:48

I am getting the right answer for many numbers uptil 999999999 on Ideone for my code in C.
But for reasons I fail to understand, I keep getting a Wrong Answer whenever I submit it here.
Can someone please tell me what is wrong?

Alberto Antonio C�ceres Peña: 2014-04-10 04:45:58

why my solution is time limit
--edit(francky)--> See the notes below, please. Code snipped.

Last edit: 2014-04-10 07:37:32
Batzorig: 2013-05-15 15:41:34

@Daniel
your solution exactly get TLE
because yours O(T*N*N)>1 second

Last edit: 2013-05-15 15:42:22
Michael T: 2010-10-29 22:29:05

Incorrect description. n definitely can be more than 999,999,999. Got AC with n <= 1,999,999,999 assumption.

Last edit: 2010-10-29 22:29:34

Added by:Rahul
Date:2007-03-10
Time limit:1s
Source limit:4000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Siddharth Agarwal