시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1177 789 711 69.231%

문제

거북이는 이제 어떤 것에도 흥미를 느끼지 않는다. 그 이유는 거북이가 300년동안 살았고, 그 동안 모든 것들을 다 해보았기 때문이다. 거북이는 시간을 떼우는 무엇인가를 하려고 한다. 이번 주말에 거북이는 거북이 세계에서 매우 유명한 게임인 "가장 큰 직사각형 만들기"를 해보려고 한다.

이 게임을 시작하기 전에 거북이는 양의 정수 네 개를 머릿 속에 생각해야 한다. 한 방향으로 움직이기 시작하고 90도 회전한 뒤에 새로운 방향으로 움직인다. 이런 식으로 세 번 90도 회전을 하고, 네 번 앞으로 움직여서 선 분 네 개를 만들어야 한다.

거북이가 선분을 그릴 때 움직여야 하는 걸음의 수는 생각해 놓은 네 정수중 하나이다. 이 때, 한 정수를 각각 한 번씩 사용해야 한다. 거북이가 정수를 사용하는 순서에 따라서 다양한 모양이 만들어진다. 어떤 모양은 직사각형을 만들 수 없기도 한다.

거북이가 만들 수 있는 가장 큰 직사각형을 계산하는 프로그램을 작성하시오.

입력

첫째 줄에 거북이가 생각한 네 양의 정수 A, B, C, D가 주어진다. (0 < A, B, C, D < 100)

출력

첫째 줄에 거북이가 만들 수 있는 가장 큰 직사각형의 면적을 출력한다.

예제 입력 1

1 2 3 4

예제 출력 1

3

힌트

아래와 같이 움직이면 면적이 3인 직사각형을 만들 수 있다.

  1. 앞으로 네 걸음간다.
  2. 오른쪽으로 방향을 바꾼다.
  3. 한 걸음 앞으로 간다.
  4. 오른쪽으로 방향을 바꾼다
  5. 세 걸음 걷는다.
  6. 방향을 다시 90도 회전한다.
  7. 두 걸음 앞으로 걷는다.
W3sicHJvYmxlbV9pZCI6IjI5NTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjNzBcdWJkODFcdWM3NzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YWM3MFx1YmQ4MVx1Yzc3NFx1YjI5NCBcdWM3NzRcdWM4MWM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hcmVhIDM6Jm5ic3A7PFwvcD5cclxuXHJcbjx1bD5cclxuXHQ8bGk+TWFrZSA0IHN0ZXBzIGZvcndhcmQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPlR1cm4gcmlnaHQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPk1ha2UgMSBzdGVwIGZvcndhcmQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPlR1cm4gcmlnaHQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPk1ha2UgMyBzdGVwcyBmb3J3YXJkOyZuYnNwOzxcL2xpPlxyXG5cdDxsaT5UdXJuIHJpZ2h0OyZuYnNwOzxcL2xpPlxyXG5cdDxsaT5NYWtlIDIgc3RlcHMgZm9yd2FyZC4mbmJzcDs8XC9saT5cclxuPFwvdWw+XHJcbiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > Croatian Open Competition in Informatics > COCI 2008/2009 > Contest #2 1번

  • 문제의 오타를 찾은 사람: adream
  • 문제를 번역한 사람: baekjoon