题目描述
Given and integer N.Calculate the sum of series 1^{3} + 2^{3} + 3^{3} + 4^{3} + … till N-th term.
Example 1:
Input:
N=5
Output:
225
Explanation:
1^{3}+2^{3}+3^{3}+4^{3}+5^{3}=225
Example 2:
Input:
N=7
Output:
784
Explanation:
1^{3}+2^{3}+3^{3}+4^{3}+5^{3}+6^{3}+7^{3}=784
Your Task:
You don't need to read input or print anything.Your task is to complete the function sumOfSeries() which takes the integer N as parameter and returns the sum of the cubes of the first N natural numbers.
Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)
Constraints:
1<=N<=50000
输入格式
见题面
输出格式
见题面
样例输入
N=5
样例输出
225