Last active
August 29, 2015 14:12
-
-
Save nothingrealhappen/caa2c1ac6e706f81cb00 to your computer and use it in GitHub Desktop.
「Geek每日一题」2014.12.30
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
Come on ! |
Author
nothingrealhappen
commented
Dec 30, 2014
def count (n, sum=0, adult=1, born=[0, 0, 0])
return sum if n < 0
count(n - 1, sum + adult, adult + born[0], [born[1], born[2], adult])
end
puts count(100)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment