48. Tổng từ 1 đến n²


Submit solution

Points: 50
Time limit: 1.0s
Memory limit: 256M

Problem type

a bình phương (kí hiệu a²) là tích a × a.
Ví dụ: 4² = 4 × 4 = 16.

Yêu cầu

Nhập số tự nhiên n (1 ≤ n ≤ 20). Tính tổng:

S = 1² + 2² + 3² + … + n²

Input

Một số tự nhiên n (1 ≤ n ≤ 20).

Output

Tổng S.

Ví dụ 1

Input:

4

Output:

30

Giải thích: n = 4
S = 1² + 2² + 3² + 4² = 1 + 4 + 9 + 16 = 30.

Ví dụ 2

Input:

10

Output:

385


Comments

There are no comments at the moment.