Created
August 4, 2015 18:29
-
-
Save fallengiants/4141819bc12be7ffad34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.upto(3**8).each do |i| | |
| flags = i.to_s(3).rjust(8, ?0).split(//) | |
| math = '' | |
| 1.upto(9).map do |c| | |
| math += c.to_s | |
| math += case flags.shift | |
| when ?1 then ?+ | |
| when ?2 then ?- | |
| else '' | |
| end | |
| end | |
| puts math if eval(math) == 100 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment