The problem comes from knowing
When I finished the discovery, the knowledge is better than I write, I am crying!!!
When I'm done, I find out that it's not what it is. The function, when affixed to the LUA code n is very large, the estimate is not resistant, the code needs to be optimized.
function banana (n) local c = 1; if n = = 0 Then return 0 ElseIf n = 1 then return 1 elseif n = 2 then return 2 end return (BA Nana (n-1) + banana (n-2)) * C;endfor i = 1, ten do print (banana (i)) end
Optimized code:
Local know = {}function banana (n) if know[n] then return know[n] end local c = 1; if n = = 0 Then know[n] = 0 return 0 elseif n = = 1 then know[n] = 1 return 1 elseif n = 2 Then
know[n] = 2 return 2 end Local r = (banana (n-1) + banana (n-2)) * C; Know[n] = R return rendfor i = 1, do print (I, banana (i)) end
Monkey pick a banana can pick 1 or 2, a total of 50, ask how many kinds of pick-up method?