Assume each pair of newly born male and female rabbits will grow into adult rabbits in two months. From the third month, they can give birth to a pair of male and female rabbits each month.
If a pair of male and female rabbits are born on the first day of the first month, and rabbits can survive forever. How many pairs of rabbits will live on this farm in the Nth month?
假設在一個農場中,每對雌雄小兔子生出來後,經過兩個月可成長成兩隻雌雄大兔子,且從第三個月開始每個月可以生出一對雌雄小兔子。假設第一個月初誕生了一對雌雄小兔子,如果兔子可以永遠存活下去,請問第 N 個月,該農場中會有多少對兔子?
Each test case contains an integer representing the Nth month, 1 ≤ N ≤ 90.
每一個測試案例包含一個整數表示第 N 個月, 1 ≤ N ≤ 90 。
Print how many pairs of rabbits will be on the farm in the Nth month, and please end with a newline character.
輸出第 N 個月農場會有多少對兔子,最後必須有換行字元。
5
5
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |