시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1452 977 888 69.484%

문제

거북이는 이제 어떤 것에도 흥미를 느끼지 않는다. 그 이유는 거북이가 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. 두 걸음 앞으로 걷는다.
W3sicHJvYmxlbV9pZCI6IjI5NTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjNzBcdWJkODFcdWM3NzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YWM3MFx1YmQ4MVx1Yzc3NFx1YjI5NCBcdWM3NzRcdWM4MWMg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G9mIGFyZWEgMzombmJzcDs8XC9wPlxyXG5cclxuPHVsPlxyXG5cdDxsaT5NYWtlIDQgc3RlcHMgZm9yd2FyZDsmbmJzcDs8XC9saT5cclxuXHQ8bGk+VHVybiByaWdodDsmbmJzcDs8XC9saT5cclxuXHQ8bGk+TWFrZSAxIHN0ZXAgZm9yd2FyZDsmbmJzcDs8XC9saT5cclxuXHQ8bGk+VHVybiByaWdodDsmbmJzcDs8XC9saT5cclxuXHQ8bGk+TWFrZSAzIHN0ZXBzIGZvcndhcmQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPlR1cm4gcmlnaHQ7Jm5ic3A7PFwvbGk+XHJcblx0PGxpPk1ha2UgMiBzdGVwcyBmb3J3YXJkLiZuYnNwOzxcL2xpPlxyXG48XC91bD5cclxuIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

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

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