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

366/642

Solve/Submission

Ranking

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

Your feedback is our precious!



Or call +88 02 9853138 for support