The Crypto Problem

Given K random integers ranging from 0 to N, and one more such number which is referred to as the "goal", write an expression involving all K given integers and (K-1) instances of the four basic arithmetic operators which evaluates to the goal.

Sample Crypto Problems and Solutions

The following problems are examples of crypto problems, with the solutions written as fully parenthesized expressions that use + for addition, - for subtraction, * for multiplication, and / for division.
  1. Can you make 2 from (3 7 8 5 8)?
    Yes, one solution is: ( ( (3 + 7) * (8 / 8) / 5)
  2. Can you make 5 from (15 11 2 4 15)?
    Yes, one solution is: ( (15 - 15) + (11 - (2 + 4) ) )
  3. Can you make 1 from (12 14 11 12 5)?
    Yes, one solution is: ( (5 - (14 - 11) ) - (12 / 12) )
  4. Can you make 13 from (12 4 10 15 5)?
    Yes, one solution is: ( ( (15 + 5) - 10) + (12 / 4) )
  5. Can you make 15 from (5 1 1 10 11)?
    Yes, one solution is: ( ( ( (10 + 11) - 1) - 5) / 1)
  6. Can you make 0 from (7 11 4 13 3)?
    Yes, one solution is: ( ( (11 - 7) - 4) * (13 + 3) )
  7. Can you make 8 from (12 4 2 2 1)?
    Yes, one solution is: ( (12 - 4) * ( (2 / 2) / 1) )
  8. Can you make 1 from (9 11 14 2 13)?
    Yes, one solution is: ( (14 -13) * (9 / (11 - 2) ) )
  9. Can you make 3 from (0 9 0 9 7)?
    No, there is no solution.
  10. Can you make 13 from (1 6 12 1 8)?
    Yes, one solution is: ( (12 * 1) + (8 - (6 + 1) ) )