[요약] 숫자 네개가 주어질 때 네 수의 조합으로 한 방향 90 도 꺽는 동작으로 닫힌 사각형을 만들 때 이 중 최대 면적을 구하는것이 문제이다.
예를 들어 , 1 2 3 4 가 주어진다면 최대 면적은 3 이다.
To start with, Kornislav needs four positive integers. He tries to enclose a rectangle by moving in one direction, then turning 90 degrees, then walking in the new direction etc. Kornislav makes a total of three 90-degree turns and walks four segments.
When walking in some direction, the number of steps he takes must be equal to one of the four chosen integers and each integer must be used exactly once. Depending on the order in which Kornislav uses the integers, his walk will make various shapes, some of which don't contain enclosed rectangles.
Write a program that calculates the largest rectangle the turtle can enclose with its walk.
input 1 2 3 4 output 3 input 4 4 3 4 output 12
출처: coci 2008/2009 1/6