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

361/633

Solve/Submission

Ranking

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

Your feedback is our precious!



Or call +88 02 9853138 for support