#K57972. Counting Rectangles in a Grid
Counting Rectangles in a Grid
Counting Rectangles in a Grid
In this problem, you are given two integers n and m representing the dimensions of a grid. Your task is to determine the total number of different rectangles that can be formed within the grid.
The number of rectangles can be computed using the formula:
( \frac{n(n+1),m(m+1)}{4} )
where n is the number of rows and m is the number of columns.
inputFormat
The input consists of a single line with two space-separated integers, n and m, where:
- n: the number of rows in the grid
- m: the number of columns in the grid
outputFormat
Output a single integer representing the total number of different rectangles that can be formed in the grid.## sample
2 2
9