HDU - 2524 矩形A + B

Description

给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格.

Input

第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n < 100 , m < 100).

Output

每行输出网格中有多少个矩形.

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;
}
发布了339 篇原创文章 · 获赞 351 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/Aibiabcheng/article/details/105353517