시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB52427177.489%

문제

Input any five positive integral numbers n1, n2, n3, n4, n5, such that 0 ≤ ni ≤ 100, 1 ≤ i ≤ 5. To the first four positive integral numbers (n1, n2, n3, n4) the arithmetic operation, such as addition (+), subtraction (-), multiplication (*), or division (/) and brackets ('(',')') may be freely applied, but in the arithmetic expression formed with these numbers and operations, every one of the four integral numbers should be used once and only once. 

Write a program for finding an arithmetic expression that satisfies the above requirement and equals n5.

입력

The input file consists of a number of data sets.Each data set is a line of 5 numbers separated by blank.A line of a single -1 represents the end of input.

출력

For each data set output the original data set first.If the program finds out the expression for these four arbitrary input numbers, then it gives out the output "OK!";On the contrary, if the program could not get the result of n5 by any arithmetic operations to the four input numbers, it gives output "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!

출처

ICPC > Regionals > Asia East Continent > China > Xi'an > Xi'an Regional Contest 2002 A번

  • 데이터를 추가한 사람: simm4256