Axis-Aligned Area
InterviewTime limit2sMemory limit1024 MB
Given four sorted stick lengths, find the largest area of an axis-aligned rectangle the sticks can enclose.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Statement
Alex has four sticks with positive integer lengths , , , and (). She places each stick parallel to one of the two coordinate axes. Find the largest area that the sticks can enclose.
Input
Four positive integers , , , and are given, each on a separate line, in non-decreasing order ().
Output
Print the maximum area that can be enclosed.
Hint
The figure below shows one optimal placement for the first sample. The enclosed area is shaded in gray.
