
56  ZOJ Monthly, October 2006  1008
Considering a light entering three adjacent planes of glass. At any meeting surface, the light may either reflect or continue straight through. For example, here is the light bouncing five times before it leaves the glass. Given the times the light bounces before leaving the glass, you are asked to tell how many different paths the light can take before leaving the glass. Input: Input contains serverl test cases, each test case contains only one integer n (0 <= n <= 60) indicates how many bounces the light take. Output: Output how many different paths the light can take. Sample Input:
0 1 Sample Output:
1 3 Hint: n = 0, the light leave the glass without any bounces, it go straight through the glass. n = 1, there are three ways for the light to travel with one bouncebounce at the middle two meeting faces plus the bottom one. Author: ZHU, Kai 