Accepted
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
ll ans = 0;
int h,w;
cin >> h >> w;
for(int i = 1; i <= min(h,w); i++) {
ll _h = h - i + 1, _w = w - i + 1;
ans += _h * _w;
}
cout << ans << '\n';
return;
}
int32_t main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);
int tc = 1;
// cin >> tc;
for(int kase = 1; kase <= tc; kase++) {
//cout << "Case " << kase << ": ";
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1121 Square Counting Challenge
- Contest
- Brain Booster #7
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 14:34:15
- Judged At
- 2024-11-11 02:33:10
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 348.0 KiB