시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 113 5 4 20.000%

문제

n1부터 n5까지 총 5가지 양의 정수를 입력합니다. 정수 n의 범위는 0 ≤ n ≤ 100 사이입니다. 그리고 입력된 4개의 정수(n1 부터 n4)를 가지고 산술 기호로 연산을 합니다.

이 때 산술 기호란 덧셈(+), 뺄셈(-), 곱셈(*), 나눗셈(/), 괄호('(',')')가 있으며 이 모든 연산자는 자유롭게 쓰일 순 있으나 산술 표현식에선 각 정수 사이에선 하나의 연산자만 사용 가능합니다.

이제 n1부터 n4까지 산술 기호로 자유롭게 연산하여 최종적으로 정답이 n5가 되는지 확인하는 프로그램을 작성하세요!

입력

입력 파일은 하나의 정수 데이터로 구성되어 있습니다. 각 데이터들은 5개의 요소로 이루어져 있으며, 모두 공백으로 분리되어 있습니다.

프로그램을 종료하기 위해 -1을 입력하면 프로그램을 종료하도록 해야합니다.

출력

각 정수 데이터들의 결과는 입력한 즉시 바로 입력한 줄에 출력하도록 하세요.

만약, n1부터 n4까지 연산했을 때 n5라는 결과가 나올 수 있다면 "OK!"를 출력합니다. 하지만 그렇지 못할 경우 "NO!"를 출력합니다.

예제 입력 1

1 2 3 4 50
2 3 10 1 61
-1

예제 출력 1

1 2 3 4 50 NO!
2 3 10 1 61 OK!
W3sicHJvYmxlbV9pZCI6Ijk4MTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjYzRcdWMwYjBcdWFlMzAiLCJkZXNjcmlwdGlvbiI6IjxwPm48c3ViPjE8XC9zdWI+XHViZDgwXHVkMTMwIG48c3ViPjU8XC9zdWI+XHVhZTRjXHVjOWMwIFx1Y2QxZCA1XHVhYzAwXHVjOWMwIFx1YzU5MVx1Yzc1OCBcdWM4MTVcdWMyMThcdWI5N2MgXHVjNzg1XHViODI1XHVkNTY5XHViMmM4XHViMmU0LiBcdWM4MTVcdWMyMTggblx1Yzc1OCBcdWJjOTRcdWM3MDRcdWIyOTQgMCAmbGU7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bWJlcnMgc2VwYXJhdGVkIGJ5IGJsYW5rLkEgbGluZSBvZiBhIHNpbmdsZSAtMSByZXByZXNlbnRzIHRoZSBlbmQgb2YgaW5wdXQuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+Rm9yIGVhY2ggZGF0YSBzZXQgb3V0cHV0IHRoZSBvcmlnaW5hbCBkYXRhIHNldCBmaXJzdC5JZiB0aGUgcHJvZ3JhbSBmaW5kcyBvdXQgdGhlIGV4cHJlc3Npb24gZm9yIHRoZXNlIGZvdXIgYXJiaXRyYXJ5IGlucHV0IG51bWJlcnMsIHRoZW4gaXQgZ2l2ZXMgb3V0IHRoZSBvdXRwdXQgJnF1b3Q7T0shJnF1b3Q7XHVmZjFiT24gdGhlIGNvbnRyYXJ5LCBpZiB0aGUgcHJvZ3JhbSBjb3VsZCBub3QgZ2V0IHRoZSByZXN1bHQgb2YgbjUgYnkgYW55IGFyaXRobWV0aWMgb3BlcmF0aW9ucyB0byB0aGUgZm91ciBpbnB1dCBudW1iZXJzLCBpdCBnaXZlcyBvdXRwdXQgJnF1b3Q7Tk8hJnF1b3Q7LjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

ACM-ICPC > Regionals > Asia > China > Xi'an > Xi'an Regional Contest 2002 A번

  • 문제를 번역한 사람: egpaltair
  • 데이터를 추가한 사람: simm4256
  • 문제의 오타를 찾은 사람: temp