We are given a N*M grid, print the number of rectangles in it.
Examples:
Input : N = 2, M = 2
Output : 9
There are 4 rectangles of size 1 x 1.
There are 2 rectangles of size 1 x 2
There are 2 rectangles of size 2 x 1
There is 1 rectangle of size 2 X 2.
Input : N = 5, M = 4
Output : 150
Example :
Input :
The first line of input contains an integer T denoting the Test cases. Then T test cases follow.
Second line contains N and M
Output :
Number of Rectangles.
Constraints :
1 ≤ T ≤ 100
1 ≤ N M ≤ 100
Input :
2
2 2
5 4
Output :
9
150
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
codersanjeev | 66 |
snow_den_ | 60 |
BoggavarapuRamSaranSaiSrinivasGupta | 60 |
rajupraaa1234 | 53 |
SUZAKU | 49 |
mr_kksparrow | 433 |
manvirag982 | 258 |
snow_den_ | 232 |
arpit_anshuman | 228 |
SoumyaKaushik | 205 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |