0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 17:32:00 +00:00

P2241 统计方形(数据加强版)

https://www.luogu.com.cn/record/171407830
This commit is contained in:
Baoshuo Ren 2024-08-08 16:32:40 +08:00
parent dea08bfa34
commit 6e204c1db6
Failed to extract signature

26
Luogu/P2241/P2241.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
int n, m;
long long ans1, ans2;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
ans1 += std::min(i, j); // 正方形
ans2 += static_cast<long long>(i) * j - std::min(i, j); // 长方形 = 矩形 - 正方形
}
}
cout << ans1 << ' ' << ans2 << endl;
return 0;
}