矩形A + B

来源:互联网 发布:大数据专业就业待遇 编辑:程序博客网 时间:2024/04/28 17:48

矩形A + B

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 32   Accepted Submission(s) : 31

Font: Times New Roman | Verdana | Georgia

Font Size: ← →

Problem Description

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

Input

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

Output

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

Sample Input

21 22 4

Sample Output

330
一排一排看
#include<cstdio>#include<cstdlib>#include<cstring>using namespace std;int main(){    __int64 n,m,s,t;    while(scanf("%I64d",&t)==1){        while(t--){    scanf("%I64d%I64d",&m,&n);        s=((n*n+n)/2)*((m*m+m)/2);        printf("%I64d\n",s);        }    }    return 0;}
0 0
原创粉丝点击