PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: raysh07
Tester: sushil2006
Editorialist: iceknight1093
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
You have a rectangular paper of size A\times B.
You want to cut out a square-sized paper from it.
What’s the maximum possible area of this square?
You’re only allowed to make horizontal or vertical cuts.
EXPLANATION:
A square has equal length and width.
So, the side length of the square is limited by both A and B.
Thus, the maximum possible side length achievable is \min(A, B).
The area of the square is obtained by multiplying the side length of the square by itself, and hence equals
\min(A, B) \times \min(A, B)
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
a, b = map(int, input().split())
print(min(a, b) * min(a, b))