DCP-154: Square Sum Difference Back to All Problems

Easy Math > Number Theory


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


Problem Setter:

Bakhtiar Hasan

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats

373/657

Solve/Submission

Ranking

# User Language Timing
01 Mehedi07 Cpp14 0.00s
02 MAHRahat Cpp14 0.00s
03 Koushik54 Cpp14 0.00s
04 feodorv C 0.00s
05 sadia2427 Cpp14 0.00s
06 FariD Cpp14 0.00s
07 kpretomazi Cpp 0.00s
08 abdulmukit Cpp 0.00s
09 mamun02inf Cpp 0.00s
10 afzalul Cpp14 0.00s
11 Not_Found0001 Cpp 0.00s
12 _dipu Cpp14 0.01s
13 nazmul_bzs Cpp14 0.01s
14 Rafiqul01 Cpp14 0.01s
15 t0whid Cpp 0.01s
16 joymollick Cpp14 0.01s
17 waqqas Cpp 0.01s
18 muntasir10mu Cpp 0.01s
19 ruhul_amin1122 Cpp 0.01s
20 souravahmed C 0.01s
21 milon019 Cpp 0.01s
22 Ruhul1975 Cpp 0.01s
23 Ratul23 Cpp 0.01s
24 Minhaj10 C 0.01s
25 exceptional_prapti Cpp 0.01s
26 mahmud2690 Cpp 0.01s
27 Raju47 Cpp 0.01s
28 ashikvai Cpp 0.01s
29 KM_Muntasir Cpp 0.01s
30 Frdhsn C 0.01s
31 Morass Cpp14 0.01s
32 Alnoman120113 C 0.01s
33 Mahadi024 Cpp14 0.01s
34 hmtanbir Cpp14 0.01s
35 sk_roy Cpp14 0.01s
36 n433m Cpp 0.01s
37 sojeeeeb Cpp 0.01s
38 seyedssz Cpp14 0.01s
39 SakibAlamin Cpp14 0.01s
40 giash_uddin Cpp14 0.01s
41 Nazmul0092 Cpp14 0.01s
42 smriad Cpp14 0.01s
43 joy25896 Cpp14 0.01s
44 return_SS Cpp14 0.02s
45 alhelal_cse Cpp14 0.02s
46 golapraj Cpp14 0.02s
47 Alamgir_Hossain Cpp14 0.02s
48 AlaminJust Cpp14 0.02s
49 fearless_hasan Cpp14 0.02s
50 terminator_c Cpp14 0.02s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support