Accepted
Code
/*
* @author Md. Fahmidur Rahman Nafi
* @create date 05-11-2024 20:32:48
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double
#define ull unsigned long long
#define lcm(a,b) ((a*b)/__gcd(a,b))
const int MOD = 1000000007;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b;
cin >> a >> b;
ll sum = a * b;
ll ans = sum;
for (int i = 2; i <= min(a, b); i++){
ans += (a - i + 1) * (b - i + 1);
}
cout << ans << endl;
}
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 15:00:37
- Judged At
- 2024-11-05 15:00:37
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB