hdu 2524矩形A + B

来源:互联网 发布:object oriented Java 编辑:程序博客网 时间:2024/06/08 01:26

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<iostream>#include<cstring>#include<cstdio>using namespace std;int main(){    int t;    scanf("%d",&t);    while(t--)    {        long long a,b;        scanf("%lld%lld",&a,&b);        printf("%lld\n",a*(a+1)/2*b*(b+1)/2);  //归纳的小矩形    }    return  0;}
0 0