/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 388.0 KiB
#2 Accepted 2ms 492.0 KiB
#3 Accepted 2ms 520.0 KiB
#4 Accepted 1ms 480.0 KiB
#5 Accepted 1ms 532.0 KiB
#6 Accepted 1ms 480.0 KiB

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