#P1348. Computing
Computing
Description
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.
Input
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.
Output
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 2 3 4 50
2 3 10 1 61
-1
1 2 3 4 50 NO!
2 3 10 1 61 OK!
Source
Xi'an 2002