22175_Rabbi

2022-5-16 18:21| 发布者: Hocassian| 查看: 24| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506175110400-Problem List-采集的数据-后羿采集器.html

Pro.ID

22175

Title

Rabbit

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22175

AC

10

Submit

36

Ratio

27.78%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    The rabbits have powerful reproduction ability. One pair of adult rabbits can give birth to one pair of kid rabbits every month. And after m months, the kid rabbits can become adult rabbits.

    As we all know, when m = 2, the sequence of the number of pairs of rabbits in each month is called Fibonacci sequence. But when m ≠ 2, the problem seems not so simple. You job is to calculate after d months, how many pairs of the rabbits are there if there is exactly one pair of adult rabbits initially. You may assume that none of the rabbits dies in this period.

    输入

    The input may have multiple test cases. In each test case, there is one line having two integers m ( 1 ≤ m ≤ 10 ), d ( 1 ≤ d ≤ 100 ), m is the number of months after which kid rabbits can become adult rabbits, and d is the number of months after which you should calculate the number of pairs of rabbits. The input will be terminated by m = d = 0.

    输出

    Description

    The rabbits have powerful reproduction ability. One pair of adult rabbits can give birth to one pair of kid rabbits every month. And after m months, the kid rabbits can become adult rabbits.

    As we all know, when m = 2, the sequence of the number of pairs of rabbits in each month is called Fibonacci sequence. But when m ≠ 2, the problem seems not so simple. You job is to calculate after d months, how many pairs of the rabbits are there if there is exactly one pair of adult rabbits initially. You may assume that none of the rabbits dies in this period.

    Input

    The input may have multiple test cases. In each test case, there is one line having two integers m ( 1 ≤ m ≤ 10 ), d ( 1 ≤ d ≤ 100 ), m is the number of months after which kid rabbits can become adult rabbits, and d is the number of months after which you should calculate the number of pairs of rabbits. The input will be terminated by m = d = 0.

    Output

    You must print the number of pairs of rabbits after d months, one integer per line.

    Sample Input

    2 3
    3 5
    0 0

    Sample Output

    5
    9

    Source

    样例输入

    2 3
    3 5
    0 0

    样例输出

    5
    9

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部