just the first quest..
perl -E "say for grep{eval $_ == 100} glob join '{+,-,}',1..9"
PS sorry missed: -1+2-3+4+5+6+78+9
perl -E "say for grep{eval $_ == 100} glob '{-,}'.join '{+,-,}',1..9"
L*
UPDATE Feb 21 2018, just for my own pleasure:
1. Show all solutions that sum to 100
2. Show the sum that has the maximum number of solutions (from zero to infinity*)
3. Show the lowest positive sum that can't be expressed (has no solutions), using the rules for this task
4. Show the ten highest numbers that can be expressed using the rules for this task (extra credit)
perl -MList::Util="first" -E "@c[0..10**6]=(0..10**6);say for grep{$e=
+eval;$c[$e]=undef if $e>=0;$h{$e}++;eval $_==100}glob'{-,}'.join'{+,-
+,}',1..9;END{say for(sort{$h{$b}<=>$h{$a}}grep{$_>=0}keys %h)[0],firs
+t{defined $_}@c;say for(sort{$b<=>$a}grep{$_>0}keys %h)[0..9]}"
-1+2-3+4+5+6+78+9
1+2+3-4+5+6+78+9
1+2+34-5+67-8+9
1+23-4+5+6+78-9
1+23-4+56+7+8+9
12+3+4+5-6-7+89
12+3-4+5+67+8+9
12-3-4+5-6+7+89
123+4-5+67-89
123+45-67+8-9
123-4-5-6-7+8-9
123-45-67+89
9
211
123456789
23456790
23456788
12345687
12345669
3456801
3456792
3456790
3456788
3456786
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.