• 2274 Get Out of the Glass

    时间限制 : 2000/1000 MS(Java/Others) | 内存限制 : 65536/32768 KB(Java/Others)

    提交数 : 60 | 通过数 : 27

    题目描述

    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 contains serverl test cases, each test case contains only one integer n (0 <= n <= 50) indicates how many bounces the light take.

    输出要求

    Output how many different paths the light can take.

    输入样例

    0
    1
    

    输出样例

    1
    3
    

    提示

    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 bounce--bounce at the middle two meeting faces plus the bottom one.
    

    来源

    ZOJ Monthly, October 2006

    [ 返回顶端 ] | [ 代码提交 ] | [ 统计数据 ] | [ 历史提交 ]