/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Accepted 1ms 320.0 KiB
#4 Accepted 1ms 324.0 KiB
#5 Accepted 1ms 328.0 KiB
#6 Accepted 1ms 412.0 KiB

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-11 02:31:48
Judged By
Score
100
Total Time
1ms
Peak Memory
412.0 KiB