当前位置: 代码迷 >> 综合 >> 矩形A + B 2524
  详细解决方案

矩形A + B 2524

热度:2   发布时间:2023-12-18 22:57:07.0

Problem Description

给你一个高为,宽为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 <iostream>
int main(int argc, const char *argv[])
{
int t = 0;
std::cin >> t;
while(t --)
{
int n = 0, m = 0;
std::cin >> n >> m;
std::cout << ((n + 1) * n / 2) * ((m + 1) * m / 2) << std::endl;
}
//system("pause");
return 0;
}