/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 13ms 3.02 MiB
#2 Accepted 13ms 3.129 MiB
#3 Accepted 13ms 2.941 MiB
#4 Accepted 16ms 2.996 MiB
#5 Accepted 14ms 3.016 MiB
#6 Accepted 15ms 2.945 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-05 14:38:59
Judged By
Score
100
Total Time
16ms
Peak Memory
3.129 MiB