P20818 [GeeksforGeeks] Squares in nn chessboard1801
普及-
题目描述

Find the total number of Squares in a N*N chessboard.

Example 1:
Input:
N = 1
Output:
1
Explanation:
A 11 chessboard has only 1 square.
Example 2:
Input:
N = 2
Output:
5
Explanation:
A 2
2 chessboard has 5 squares.
4 11 squares and a 22 square.

Your Task:
You don't need to read input or print anything. Your task is to complete the function squaresInChessBoard() which takes an Integer N as input and returns the number of squares in a N*N chessboard.

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N <= 10^{5}

输入格式

见题面

输出格式

见题面

样例输入
N = 1
样例输出
1