/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 484.0 KiB
#2 Wrong Answer 1ms 320.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define arr_for(n) for (int i = 0; i < n; i++)
#define arrj_for(n) for (int j = 0; j < n; j++)
#define rev_arr_for(n) for (int i = n - 1; i >= 0; i--)
#define for_one(n) for (int i = 1; i <= n; i++)
#define pf push_front
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define newl "\n"
using namespace std;

void solve() {
    ll h, w;
    cin >> h >> w;

    ll ans = h * w;
    for (int i = 2; i <= min<ll>(h, w); i++) {
        ans += ((h - i) + 1) * ((w - i) + 1);
    }

    cout << ans << newl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int testcase = 1;
    // cin >> testcase;

    while (testcase--) {
        solve();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1121 Square Counting Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-06 09:37:17
Judged At
2024-11-11 02:25:24
Judged By
Score
0
Total Time
1ms
Peak Memory
484.0 KiB