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; +}