Skip to content

Instantly share code, notes, and snippets.

@a-b
Created February 29, 2012 00:16
Show Gist options
  • Save a-b/1936414 to your computer and use it in GitHub Desktop.
Save a-b/1936414 to your computer and use it in GitHub Desktop.
signs_set = ('+' + '-' * 2 + ' ' * 5).split ''
signs_set.permutation(signs_set.length).to_a.uniq.each_with_index do |r,i|
str = (1..9).to_a.zip(r).flatten.join.gsub(' ','').to_s
eq_100 = eval(str).eql?(100)
puts [(i+1).to_s.rjust(3), '', str, '=', eval(str), eq_100 ? ' <---- !':'' ].join("\t")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment