Make10
Solve Make10 problem.
Usage
You can solve "Make10" problem by the following way.
1, 2, 3, 4 case,
irb(main):005:0> Make10.solve(1,2,3,4)
=> ["1+2+3+4", "(1+2)+(3+4)", "((1+2)+3)+4", "(1+(2+3))+4", "1+((2+3)+4)", "1+(2+(3+4))", "1*2*3+4", "((1*2)*3)+4", "(1*(2*3))+4", "1*((2*3)+4)", "1+2+4+3", "(1+2)+(4+3)", "((1+2)+4)+3", "(1+(2+4))+3", "1+((2+4)+3)", "1+(2+(4+3))", "1+3+2+4", "(1+3)+(2+4)", "((1+3)+2)+4", "(1+(3+2))+4", "1+((3+2)+4)", "1+(3+(2+4))", "(1+(3/2))*4", "1*3*2+4", "((1*3)*2)+4", "(1*(3*2))+4", "1*((3*2)+4)", "1+3+4+2", "(1+3)+(4+2)", "((1+3)+4)+2", "(1+(3+4))+2", "1+((3+4)+2)", "1+(3+(4+2))", "1*3*4-2", "((1*3)*4)-2", "(1*(3*4))-2", "1*((3*4)-2)", "1+4+2+3", "(1+4)+(2+3)", "((1+4)+2)+3", "(1+(4+2))+3", "1+((4+2)+3)", "1+(4+(2+3))", "1*4+2*3", "(1*4)+(2*3)", "1*(4+(2*3))", "1+4+3+2", "(1+4)+(3+2)", "((1+4)+3)+2", "(1+(4+3))+2", "1+((4+3)+2)", "1+(4+(3+2))", "1*4+3*2", "(1*4)+(3*2)", "1*(4+(3*2))", "1*4*3-2", "((1*4)*3)-2", "(1*(4*3))-2", "1*((4*3)-2)", "2+1+3+4", "(2+1)+(3+4)", "((2+1)+3)+4", "(2+(1+3))+4", "2+((1+3)+4)", "2+(1+(3+4))", "2-((1-3)*4)", "2*1*3+4", "((2*1)*3)+4", "(2*(1*3))+4", "2/1*3+4", "((2/1)*3)+4", "(2/(1/3))+4", "2+1+4+3", "(2+1)+(4+3)", "((2+1)+4)+3", "(2+(1+4))+3", "2+((1+4)+3)", "2+(1+(4+3))", "2+3+1+4", "(2+3)+(1+4)", "((2+3)+1)+4", "(2+(3+1))+4", "2+((3+1)+4)", "2+(3+(1+4))", "2+((3-1)*4)", "2*3+1*4", "(2*3)+(1*4)", "2*3*1+4", "((2*3)*1)+4", "(2*(3*1))+4", "2*3/1+4", "((2*3)/1)+4", "(2*(3/1))+4", "2+3+4+1", "(2+3)+(4+1)", "((2+3)+4)+1", "(2+(3+4))+1", "2+((3+4)+1)", "2+(3+(4+1))", "2*3+4*1", "(2*3)+(4*1)", "((2*3)+4)*1", "2*3+4/1", "(2*3)+(4/1)", "((2*3)+4)/1", "2+4+1+3", "(2+4)+(1+3)", "((2+4)+1)+3", "(2+(4+1))+3", "2+((4+1)+3)", "2+(4+(1+3))", "2-(4*(1-3))", "2*4-1+3", "((2*4)-1)+3", "(2*4)-(1-3)", "2+4+3+1", "(2+4)+(3+1)", "((2+4)+3)+1", "(2+(4+3))+1", "2+((4+3)+1)", "2+(4+(3+1))", "2+(4*(3-1))", "2*4+3-1", "(2*4)+(3-1)", "((2*4)+3)-1", "3+1+2+4", "(3+1)+(2+4)", "((3+1)+2)+4", "(3+(1+2))+4", "3+((1+2)+4)", "3+(1+(2+4))", "3-1+2*4", "(3-1)+(2*4)", "3-(1-(2*4))", "(3-(1/2))*4", "3*1*2+4", "((3*1)*2)+4", "(3*(1*2))+4", "3/1*2+4", "((3/1)*2)+4", "(3/(1/2))+4", "3+1+4+2", "(3+1)+(4+2)", "((3+1)+4)+2", "(3+(1+4))+2", "3+((1+4)+2)", "3+(1+(4+2))", "3-1+4*2", "(3-1)+(4*2)", "3-(1-(4*2))", "((3-1)*4)+2", "3*1*4-2", "((3*1)*4)-2", "(3*(1*4))-2", "3/1*4-2", "((3/1)*4)-2", "(3/(1/4))-2", "3+2+1+4", "(3+2)+(1+4)", "((3+2)+1)+4", "(3+(2+1))+4", "3+((2+1)+4)", "3+(2+(1+4))", "3*2+1*4", "(3*2)+(1*4)", "3*2*1+4", "((3*2)*1)+4", "(3*(2*1))+4", "3*2/1+4", "((3*2)/1)+4", "(3*(2/1))+4", "((3/2)+1)*4", "3+2+4+1", "(3+2)+(4+1)", "((3+2)+4)+1", "(3+(2+4))+1", "3+((2+4)+1)", "3+(2+(4+1))", "3+2*4-1", "(3+(2*4))-1", "3+((2*4)-1)", "3*2+4*1", "(3*2)+(4*1)", "((3*2)+4)*1", "3*2+4/1", "(3*2)+(4/1)", "((3*2)+4)/1", "3+4+1+2", "(3+4)+(1+2)", "((3+4)+1)+2", "(3+(4+1))+2", "3+((4+1)+2)", "3+(4+(1+2))", "3*4-1*2", "(3*4)-(1*2)", "3*4*1-2", "((3*4)*1)-2", "(3*(4*1))-2", "3*4/1-2", "((3*4)/1)-2", "(3*(4/1))-2", "3+4+2+1", "(3+4)+(2+1)", "((3+4)+2)+1", "(3+(4+2))+1", "3+((4+2)+1)", "3+(4+(2+1))", "3+4*2-1", "(3+(4*2))-1", "3+((4*2)-1)", "3*4-2*1", "(3*4)-(2*1)", "((3*4)-2)*1", "3*4-2/1", "(3*4)-(2/1)", "((3*4)-2)/1", "4+1+2+3", "(4+1)+(2+3)", "((4+1)+2)+3", "(4+(1+2))+3", "4+((1+2)+3)", "4+(1+(2+3))", "4+1*2*3", "4+((1*2)*3)", "4+(1*(2*3))", "4*1+2*3", "(4*1)+(2*3)", "4/1+2*3", "(4/1)+(2*3)", "4+1+3+2", "(4+1)+(3+2)", "((4+1)+3)+2", "(4+(1+3))+2", "4+((1+3)+2)", "4+(1+(3+2))", "4+1*3*2", "4+((1*3)*2)", "4+(1*(3*2))", "4*1+3*2", "(4*1)+(3*2)", "4*(1+(3/2))", "4*1*3-2", "((4*1)*3)-2", "(4*(1*3))-2", "4/1+3*2", "(4/1)+(3*2)", "4/1*3-2", "((4/1)*3)-2", "(4/(1/3))-2", "4+2+1+3", "(4+2)+(1+3)", "((4+2)+1)+3", "(4+(2+1))+3", "4+((2+1)+3)", "4+(2+(1+3))", "4+2*1*3", "4+((2*1)*3)", "4+(2*(1*3))", "4+2/1*3", "4+((2/1)*3)", "4+(2/(1/3))", "4*2-1+3", "((4*2)-1)+3", "(4*2)-(1-3)", "4+2+3+1", "(4+2)+(3+1)", "((4+2)+3)+1", "(4+(2+3))+1", "4+((2+3)+1)", "4+(2+(3+1))", "4+2*3*1", "(4+(2*3))*1", "4+((2*3)*1)", "4+(2*(3*1))", "4+2*3/1", "(4+(2*3))/1", "4+((2*3)/1)", "4+(2*(3/1))", "4*2+3-1", "(4*2)+(3-1)", "((4*2)+3)-1", "4+3+1+2", "(4+3)+(1+2)", "((4+3)+1)+2", "(4+(3+1))+2", "4+((3+1)+2)", "4+(3+(1+2))", "4+3*1*2", "4+((3*1)*2)", "4+(3*(1*2))", "4+3/1*2", "4+((3/1)*2)", "4+(3/(1/2))", "(4*(3-1))+2", "4*3-1*2", "(4*3)-(1*2)", "4*(3-(1/2))", "4*3*1-2", "((4*3)*1)-2", "(4*(3*1))-2", "4*3/1-2", "((4*3)/1)-2", "(4*(3/1))-2", "4+3+2+1", "(4+3)+(2+1)", "((4+3)+2)+1", "(4+(3+2))+1", "4+((3+2)+1)", "4+(3+(2+1))", "4+3*2*1", "(4+(3*2))*1", "4+((3*2)*1)", "4+(3*(2*1))", "4+3*2/1", "(4+(3*2))/1", "4+((3*2)/1)", "4+(3*(2/1))", "4*3-2*1", "(4*3)-(2*1)", "((4*3)-2)*1", "4*3-2/1", "(4*3)-(2/1)", "((4*3)-2)/1", "4*((3/2)+1)"]
irb(main):007:0> Make10.solve(1,2,3,4).size
=> 324
Uh, actually they are all?w
Installation
Add this line to your application's Gemfile:
gem 'make10'
And then execute:
$ bundle
Or install it yourself as:
$ gem install make10
Usage
TODO: Write usage instructions here
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request