4.C - 递推

题目连接:http://acm.hust.edu.cn/vjudge/contest/125308#problem/C

题目要求计算 n*m的网格中矩形的个数。行和列是相当的,每一行有m!个矩形,每一列有n!个矩阵,所以一共有n!*m!个矩阵

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int t;
    int a,b,sum;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&a,&b);
        sum=a*(a+1)/2*b*(b+1)/2;
        printf("%d\n",sum);

    }
}

 

posted @ 2016-08-01 12:01  Twsc  阅读(129)  评论(0编辑  收藏  举报