a076: How many pairs of rabbits are there on the farm? 到底有幾對兔子?
標籤 :
通過比率 : 60% (3 人 / 5 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2020-04-16 12:00

內容

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
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (100%): 10.0s , <1K
提示 :
標籤:
出處:
[編輯 :
shengZJ (shengZJ)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」