Accepted
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
int minS = min(h, w);
long long tSq = 0;
for (int i = 1; i <= minS; i++) {
tSq += (long long)(h - i + 1) * (w - i + 1);
}
cout << tSq << endl;
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1121 Square Counting Challenge
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-10-29 20:12:13
- Judged At
- 2024-11-11 02:35:43
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB