Today the group out an algorithm problem, feel very funny, their elementary school when math, think can fix, think for a long time oneself still did not find solution, hey, it seems IQ still two times development. First, the topic:
50 steps, can walk 1 steps or 2 steps at a time, ask how many kinds of way?
See this question I first think of is with for, similar to 2 yuan money can have how many 1, 5 wool, 2 wool, 1 wool composition, but think carefully or not, steps this is in order, even if only one of the 50 steps is two steps there are several cases, so think first from the 2 steps of the count, up to 26 kinds, In these 26 kinds of order, so that the head is big. Fortunately, wisdom in the folk, the power of the masses Unlimited, Baidu, online has a solution, I looked under, and finally found out why I did not test Tsinghua University, IQ is flawed AH.
The online solution is: before going to the N steps, either walk 1 steps, or walk 2 steps, so f (n) =f (n-1) +f (n-2), very straightforward, but also very admire the IQ of netizens.
The Fibonacci sequence of the Olympiad