If we want to build a brick wall out of the usual size of brick which has a length twice as long as its height, and if our wall is to be two units tall, we can make our wall in a number of patterns, depending on how long we want it. From thefigure one observe that:
How many patterns can you find for a wall of length 4? And, for a wall of length 5? Your task is to write a program that given the length of a wall, determines how many patterns there may be for a wall of that length.
Your program receives a sequence of positive integers, one per line, each representing the length of a wall. The maximum value for the wall is length 50. The input terminates with a `0'.
For each wall length given in the input, your program must output the corresponding number of different patterns for such a wall in a separate line.
範例輸入 1
1 2 3 0
範例輸出 1
1 2 3
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.