2 1 2 2 4
3 30
#include <stdio.h> int main() { int t,n,m; int i,j,k; int sum1,sum2; scanf("%d",&t); for(i=1;i<=t;i++) { scanf("%d %d",&n,&m); sum1 = sum2 = 0; for(j=1;j<=n;j++) sum1 += j; for(j=1;j<=m;j++) sum2 += j; printf("%d\n",sum1*sum2); } return 0; }
原文地址:http://blog.csdn.net/holyang_1013197377/article/details/40019601