/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 13ms 3.02 MiB
#2 Accepted 14ms 2.926 MiB
#3 Accepted 13ms 3.02 MiB
#4 Accepted 13ms 3.02 MiB
#5 Accepted 13ms 2.906 MiB
#6 Accepted 15ms 3.027 MiB

Code

def count_perfect_square(H, W):
    total_count = 0
    max_k = min(H, W)
    for k in range(1, max_k + 1):
        total_count += (H - k + 1) * (W - k + 1)
    return total_count
H,W = list(map(int,input().split()))
print(count_perfect_square(H,W))

Information

Submit By
Type
Submission
Problem
P1121 Square Counting Challenge
Contest
Brain Booster #7
Language
Python 3 (Python 3.12.3)
Submit At
2024-11-05 14:48:36
Judged At
2024-11-05 14:48:36
Judged By
Score
100
Total Time
15ms
Peak Memory
3.027 MiB