Chef and Interview
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Chef wants to hire a new assistant. He published an advertisement regarding that in a newspaper. After seeing the advertisement, many candidates have applied for the job. Now chef wants to shortlist people for the interviews, so he gave all of them one problem which they must solve in order to get shortlisted.
The problem was : For a given positive integer N, what is the maximum sum of distinct numbers such that the Least Common Multiple of all these numbers is N.
Your friend Rupsa also applied for the job, but was unable to solve this problem and hence you've decided to help her out by writing a code for solving this problem.
The first line of the input contains an integer T denoting the number of test cases.
Each test case contains a single integer N.
For each test case, output a single line containing an integer corresponding to the answer for that test case.
- 1 ≤ T ≤ 1000
- 1 ≤ N ≤ 109
Subtask 1 (30 points):
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 105
Subtask 2 (70 points):
- original constraints
Input: 2 1 2 Output: 1 3
Example 1 : Only possible number is 1, so the maximum sum of distinct numbers is exactly 1.
Example 2 : The distinct numbers you can have are just 1 and 2, so the sum is 3. If we consider any other number greater than 2, then the least common multiple will be more than 2.
|Tags||abhra73, april15, lcm, simple|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.