Skip to content

Instantly share code, notes, and snippets.

@akiradeveloper
Created May 11, 2015 12:14
Show Gist options
  • Save akiradeveloper/b995761f7dc54ba006f5 to your computer and use it in GitHub Desktop.
Save akiradeveloper/b995761f7dc54ba006f5 to your computer and use it in GitHub Desktop.
演算子を挟んで合計100になる
A=["", "+", "-"]
A.product(A, A, A, A, A, A, A).each do |combi|
expr = [1,2,3,4,5,6,7,8,9].zip(combi).flatten.join("")
puts expr if eval(expr) == 100
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment