@suixinhita
2020-11-13T00:01:35.000000Z
字数 301
阅读 613
未分类
#include <cstdio>
#include <cmath>
#define ll long long
const int N = 1e5+10;
const ll Q = 998244353;
int n, m;
ll ans;
int main()
{
// freopen("1.txt", "r", stdin);
int T;
scanf("%d", &T);
while (T--)
{
ans = 0;
scanf("%d%d", &n, &m);
if (n > m)
{
int t = n; n = m; m = t;
}
for (int i = 1; i <= n; ++i)
ans += i * (n - i + 1) * (m - i + 1);
printf("%lld\n", ans);
}
return 0;
}