HDU 2524 矩形A + B

原题链接:点击此处

公式:sum=len*(len+1)/2*wid*(wid+1)/2;

 

源代码:

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    int ti,len,wid,sum;
    scanf("%d",&ti);
    while(ti--)
    {
        scanf("%d %d",&len,&wid);
        sum=len*(len+1)/2*wid*(wid+1)/2;
        printf("%d\n",sum);
    }
    return 0;
}
View Code

 

posted @ 2016-08-06 11:18  君子酱  阅读(140)  评论(0编辑  收藏  举报