HDU-2524 Rectangular A + B

Description

Give you a grid with a height of n and a width of m columns. Calculate how many rectangles there are in this grid. The figure below shows a grid with a height of 2 and a width of 4.

Input

Enter a t in the first row, indicating that there are t sets of data, and then enter n, m for each row, respectively representing the height and width of the grid (n <100, m <100).

Output

Each row outputs how many rectangles are in the grid.

Sample Input

2
1 2
2 4

Sample Output

3
30
#include <stdio.h>

int main(){
	int t;
	int n, m;
	scanf("%d", &t);
	while (t--){
		scanf("%d %d", &n, &m);
		printf("%d\n", n*(n+1)*m*(m+1)/4);
	}

	return 0;
}

 

Published 339 original articles · praised 351 · 170,000 views

Guess you like

Origin blog.csdn.net/Aibiabcheng/article/details/105353517