/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 21ms 3.066 MiB
#2 Accepted 23ms 3.125 MiB
#3 Accepted 21ms 3.027 MiB
#4 Accepted 21ms 3.051 MiB
#5 Accepted 20ms 2.965 MiB
#6 Accepted 22ms 3.062 MiB

Code

def functionality(H, W):
    total_count = 0
    max_square_size = min(H, W)
    
    for s in range(1, max_square_size + 1):
        count_for_size = (H - s + 1) * (W - s + 1)
        total_count += count_for_size
    
    return total_count

H, W = map(int, input().split())
print(functionality(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:38:59
Judged At
2024-11-11 02:32:55
Judged By
Score
100
Total Time
23ms
Peak Memory
3.125 MiB