Weekend Programming Challenge – Week #61 plus minus


Plus-minus-equals

Problem:

insert + and – in the equation below to make it right

1 2 3 4 5 6 7 8 9 = 100

like

1 + 2 + 3 – 4 + 5 + 6 + 7 8 + 9 = 100

make code which  finds all solutions.

The rules:

You can code the solution in any programming language during the weekend and have to submit it to info@olimex.com latest on Sunday July 13th.

On Monday we will upload the solutions on GitHub https://github.com/OLIMEX/WPC

You can play with your real name or with nick if you want to be anonymous, we will not disclosure your personal info if you do not want to.

2 Comments (+add yours?)

  1. Danny
    Jul 12, 2014 @ 14:35:18

    What does “right” mean? Does the equation have to be true? Because the example isn’t. (Also, it’s not possible to reach 100 with values <= 9 and just addition and subtraction. Proof by comparison: all values are = any other sum with these operands. Subtracting makes it worse, because a – b = a + (-b))

    Also, why is there no “+” and no “-” between “7” and “8” in the example? What does that mean?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: