This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
/**
母题:P1548
一、算正方形的个数
枚举每一个格子,看以它为左上角的矩形共有多少个(正方形与长方形同属于矩形)
二、算长方形个数(矩形=长方形+正方形)
1.其实算长方形并不常见,但算矩形大家应该经常遇到,所以如果你会算矩形,再联系第一个问题,那答案就转化为 矩形个数-正方形个数.
2.像求解正方形个数一样,固定矩形右下角(i,j),显然此时矩形个数为i*j.
3.同理,求和即可.然后,再减去正方形的个数就是长方形的个数啦。
*/
LL n, m, s1, s2;
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
s1 += min(i, j);//也可以理解为左上角
s2 += i * j; //也可以理解为左上角开始,也是一样的
}
cout << s1 << " " << s2 - s1 << endl;
return 0;