From 6e204c1db61c42db680a0f24d6469a183f3c0d2e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 8 Aug 2024 16:32:40 +0800 Subject: [PATCH] =?UTF-8?q?P2241=20=E7=BB=9F=E8=AE=A1=E6=96=B9=E5=BD=A2?= =?UTF-8?q?=EF=BC=88=E6=95=B0=E6=8D=AE=E5=8A=A0=E5=BC=BA=E7=89=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/171407830 --- Luogu/P2241/P2241.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Luogu/P2241/P2241.cpp diff --git a/Luogu/P2241/P2241.cpp b/Luogu/P2241/P2241.cpp new file mode 100644 index 00000000..bdd0c3c6 --- /dev/null +++ b/Luogu/P2241/P2241.cpp @@ -0,0 +1,26 @@ +#include + +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(i) * j - std::min(i, j); // 长方形 = 矩形 - 正方形 + } + } + + cout << ans1 << ' ' << ans2 << endl; + + return 0; +}