题目描述
Given a mxn matrix, count the number of squares in the matrix.
Example 1:
Input:
m = 2, n = 2
Output:
5
Explanation:
There are a total of 5 squares in a 22
matrix. Four 11 squares and one 22 square.
Example 2:
Input:
m = 4, n = 3
Output:
20
Explanation:
There are a total of 20 squares in a 43
matrix.
Your Task:
You don't need to read input or print anything. Your task is to complete the function squaresInMatrix() which takes 2 Integers m and n as input and returns the number of total squares in a m*n matrix.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 <= m,n <= 10^{4}
输入格式
见题面
输出格式
见题面
样例输入
m = 2, n = 2
样例输出
5