The sum of squares of first 5 natural numbers is, **1²+2²+3²+4²+5²=55**. The square of the sum of first 5 natural numbers is, **(1+2+3+4+5)²=225**. The absolute difference between these two numbers are **170**. Find the difference between the sum of the squares of first **N** natural numbers and the square of their sum. Input: ------ First line contains **T(1≤T ≤10000)** denoting the number of test cases. The following **T** lines contain an integer **N (1 ≤ N ≤ 10000)**, Output: ------- Print the required answer for each test cases. Sample Input ------------ 2 10 500 Sample Output ------------- 2640 15645770750
Language | Time Limit (seconds) |
C | 1.00 |
C++ | 1.00 |
C++14 | 1.00 |
C# | 3.00 |
Go | 3.00 |
Java | 3.00 |
JavaScript | 3.00 |
Objective-C | 3.00 |
Perl | 3.00 |
PHP | 3.00 |
Python | 3.00 |
Python3 | 3.00 |
Ruby | 3.00 |
VB.Net | 3.00 |
Solve/Submission
# | User | Language | Timing |
---|---|---|---|
01 | MAHRahat | Cpp14 | 0.00s |
02 | Mehedi07 | Cpp14 | 0.00s |
03 | sadia2427 | Cpp14 | 0.00s |
04 | Koushik54 | Cpp14 | 0.00s |
05 | feodorv | C | 0.00s |
06 | afzalul | Cpp14 | 0.00s |
07 | FariD | Cpp14 | 0.00s |
08 | Not_Found0001 | Cpp | 0.00s |
09 | kpretomazi | Cpp | 0.00s |
10 | abdulmukit | Cpp | 0.00s |
11 | mamun02inf | Cpp | 0.00s |
12 | ruhul_amin1122 | Cpp | 0.01s |
13 | muntasir10mu | Cpp | 0.01s |
14 | t0whid | Cpp | 0.01s |
15 | KM_Muntasir | Cpp | 0.01s |
16 | souravahmed | C | 0.01s |
17 | milon019 | Cpp | 0.01s |
18 | Ruhul1975 | Cpp | 0.01s |
19 | Ratul23 | Cpp | 0.01s |
20 | Minhaj10 | C | 0.01s |
21 | exceptional_prapti | Cpp | 0.01s |
22 | Frdhsn | C | 0.01s |
23 | Rafiqul01 | Cpp14 | 0.01s |
24 | mahmud2690 | Cpp | 0.01s |
25 | Raju47 | Cpp | 0.01s |
26 | ashikvai | Cpp | 0.01s |
27 | Morass | Cpp14 | 0.01s |
28 | Alnoman120113 | C | 0.01s |
29 | _dipu | Cpp14 | 0.01s |
30 | Mahadi024 | Cpp14 | 0.01s |
31 | sk_roy | Cpp14 | 0.01s |
32 | joymollick | Cpp14 | 0.01s |
33 | waqqas | Cpp | 0.01s |
34 | nazmul_bzs | Cpp14 | 0.01s |
35 | n433m | Cpp | 0.01s |
36 | sojeeeeb | Cpp | 0.01s |
37 | SakibAlamin | Cpp14 | 0.01s |
38 | smriad | Cpp14 | 0.01s |
39 | Nazmul0092 | Cpp14 | 0.01s |
40 | giash_uddin | Cpp14 | 0.01s |
41 | hmtanbir | Cpp14 | 0.01s |
42 | seyedssz | Cpp14 | 0.01s |
43 | joy25896 | Cpp14 | 0.01s |
44 | return_SS | Cpp14 | 0.02s |
45 | alhelal_cse | Cpp14 | 0.02s |
46 | ash12 | Cpp14 | 0.02s |
47 | Alamgir_Hossain | Cpp14 | 0.02s |
48 | terminator_c | Cpp14 | 0.02s |
49 | deder | Cpp14 | 0.02s |
50 | fearless_hasan | Cpp14 | 0.02s |
Copyright © 2015-2016 Dev Skill.