#CCBCHBA0000055. Tổng bình phương (Sum of Squares)
Tổng bình phương (Sum of Squares)
Sum of Squares
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Use a for loop to compute the sum of squares from 1 to n, performing multiplication in 64-bit.
Input
One integer 0<=n<=100000.
Output
The sum as a 64-bit integer.
Subtasks
- Subtask 1 (20%): n<=10.
- Subtask 2 (30%): n<=1000.
- Subtask 3 (50%): n<=100000.
Examples
Example 1
Input
3
Output
14
Explanation
1+4+9=14.
Example 2
Input
0
Output
0
Explanation
The empty sum equals zero.