The three rules of Ruby Q.:
Please do not post any solutions or spoiler discussion for this quiz
48 hours have passed from the time on this message.
Support Ruby Q. by submitting ideas as often as you can:
Suggestion: A [QUIZ] in the subject of emails about the problem helps
on Ruby T. follow the discussion. Please reply to the original quiz
if you can.
This quiz was adapted from an ACM programming challenge at the
Simple math can be done with toothpicks alone. Positive integers are
count of toothpicks so three becomes |||. We can use two toothpicks
build a plus sign (+) or even tilt those slightly to get a
operator (x). Putting all of that together, the expression ||x||||+| is
way to express the number nine.
This weeks quiz is to write a program that takes a single command-line
which will be a positive integer. Your code should build a toothpick
to calculate the number using as few toothpicks as possible. For
$ruby toothpick.rb 9
|||x||| = 9 (8 toothpicks)
Don’t forget to count those operators!
Posting toothpick expressions and/or counts for a given number is not