0 喜歡 0 不喜歡
1.7k 瀏覽

    Suppose there is a pair of newborn bunnies in the pasture in the first month, each pair of male and female bunnies grew into a large male and female rabbits after two months later. After three months from the start, each pair of male and female rabbit can give birth to a pair of small bunnies every month. If the rabbits can live forever, how many pairs of rabbits in the pasture in the first N month?

(1<=N<=90)(Very IMPORTANT)

Input

3

Output

2

 

Input

5

Output

5

 

Input

88

Output

1100087778366101931

[考試] 最新提問 分類:Midterm |
ID: 24269 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.7k 瀏覽

13 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>



long long int bunny (int n)

{
******* *** * * * * ** long int v1, v2, v3;
*** ** * *** count = 1;

    v1 = 0;

    v2 = 1;
** *** ** *** * *** (n==2)
***** * *** * **** **** *** ** *** *** ** * ** * 1;
* *** ** ** * ** ** ** if (n==1)
* * ** ** ** ** **** ** * *** * ** * * *** *** * ** 1;


***** * *** * ***********
** * *** *** *** ** * * * *** ** * *** (count <n)
** * * * ***** ** * ** * * ** * * *** * *
*** ** * ** * ** * ** * * ** * ** * * * ** ** *** **** ****** * ***
* ** * * ** **** * * ** * * ** * ******* * **** * *** * ** ** * * * *
** * * * ** * * *** ** *** * * *** *** * *** ***** * ** ***** **** ** *
*** * ** ***** * ** ** ** * *** * ***** * * *** * ** * * * ** ** ** ** *
** ** * * *** *** ***** ***** * * ** * ***
** * * ** ***** ** * v3;

}



int main()

{
* * * *** * * * * * num;
* ** ** *** *** ** ** *** **** * * * * &num);
* * * ** * * * * * ** ** * * *** *** bunny(num));
*** ** ** ** ******* * 0;

}
最新回答 用戶: (-48 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>



long long int fibo(int n){


* * * * ******* * ** ** long int v1=0, v2=1, v3;
* ** * * ***** c=1;

    if (n==2)
* ** * ** * * * **** * * ** **** *** 1;
* * * ** * ***** * * ** * if (n==1)
* **** * * ***** ***** **** **** * ** * 1;
* ** * *** * ***** ** * ** * * *
** * * * * **** *** * ** ** *** * * * ** *** * (c < n){
**** * ** * * ****** *** ****** *** * * * * * ** * ** * ** *** * * * * = v1 + v2;
*** * ** * ** *********** ** * * **** ** * ** *** *** *** **** ** * *** *
** * *** *** ** * *** * ** *** *** ** * * * ** *** *** ** * ** = v2;
* * * * * * * ** ** ***** ** ** * * ****** * ***** **** ** = v3;
* * **** * * * * * *** *********** *
* ** * ** *** * ** * *** * ** *** ** * * **** * v3;

}



int main(void){


** *** * * * * ** * * num;
*** * * * ****** ** * * ** * &num);
* * * * ** * * *** * ** ** ** **** fibo(num));
*** ** * *** * ** *** ** ** * 0;



}
最新回答 用戶: (20 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>



long long int rabbit(int n)

{
**** * *** **** ** ** long int val1, val2, val3;
* ** * ** **** * * * * count = 1;
* * * * ** ** ** ** = 0;
* * ** * **** * ** * * = 1;

    if (n == 2)
* * * * ** * * *** * ** * * *** * *** * * 1;
* * ** * *** * ***** *** if (n == 1)
** * ** * * ** ** *** *** ** *** *** * *** 1;
* * * ** * * *** ** *
** *** * * ** * **** * *** * * * ** * * * (count < n)
*** ****** ******* ** * *** ** *** *** * *** *
* * ** ** * ** * * * * * * * ****** ** ** ** ************ ***** **** * = val1 + val2;
* ** ** * * ** * ** * * **** * ** **** * * * * *** ***** *
* ** * ***** * * * * *** ***** * * ** ** * * ** * * *** ** = val2;
* * **** * *** ** * ** * * * * **** * * ** **** * * * ** * * * *** ** = val3;
**** ** ** * * ****** *** * * *** **** ****
* * ** * ***** ** * * * * *** * * * * val3;

}

int main()

{

    int num;
* *** *** * * **** ** ** * **** &num);
*** * *** ** * * * * * * * ****** **** * *** rabbit(num));
** ** **** * ** ** * 0;

}
最新回答 用戶: (38 分)
0 喜歡 0 不喜歡
內容已隱藏
** ** ** **** *



int ***



int n;

long long int *

int i;
** long int b;






* *** ***** ** * * **

if * ** * ** * * **






* * ** *** **

if ***
*** * * *** ** * **** * *

}

else if **
* ** *** * *** * ***** *** * *

}


* *
* *** * *



}
* * **** **



if * *
*** * ** *** ******* *** **** ** ** * ***
if ** *
****** **** * * * * *********** ** **** * * * *
*
*** ** *** * ****** * *

}
*** 0;}
最新回答 用戶: (-34 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>



long long int rabbit(int n)

{
** *** ** ** * *** ** long int value1, value2, value3;
* ** ** * ***** * count = 1;
*** * *** ** * *** * ** = 0;
* * ** * ******* *** * ** = 1;

    if (n == 2)
** * * * ** * * ** *** *** ****** * * * * 1;
* * **** * *** * * **** if (n == 1)
* * * * ** * ** ****** ** * ****** * ** ****** **** * 1;
* * *** ****** *** * * *
**** * ** * * * ** ***** * **** ** * ** *** (count < n)
* ** * * *** * * *** ** ** * ** **
* ** * ** ** * *** ****** * * * ** ** ******* ******** = value1 + value2;
******* * * * * ***** * *** * * ** **** * * * * ** *** * * *** *
* * *** *** * * ** * ** * **** *** ***** ** * * * ** * * * ***** * * * = value2;
*** * * ** ** * ***** * * *** ** * * ** ****** * *** * * * * * * = value3;
* ** ** * * ** * *** ** ***** *
* * * ** * * **** ** * * **** **** ** * * value3;

}

int main()

{
* * *** ** * num;
** * **** ****** *** ** ** * * **** * &num);
** * ** * *** ** * * * rabbit(num));
* ** * * ** ** * * 0;

}
最新回答 用戶: (44 分)
0 喜歡 0 不喜歡
內容已隱藏
** * * * ** *** *



int



int n;
long int

int i;
* * long int b;






** * *** * ** **

if *** * * ** ** * * *






* * ** *** *

if *** *
* ** **** * * ** *

}
if *
* **** * ** *** ** **

}


*
* *** ** **



}
** * * ** *



if * ****
** ** * ** * * ***** * * * * * * ** **
*
* *** * ***** * ** * ** *

}
*** 0;}
最新回答 用戶: (-34 分)
0 喜歡 0 不喜歡
內容已隱藏
#include ** * * **

#include ******* * ** *



long long int Fibonacci(int );



int main(){
* * * ** * *** * ** * ** * input;
* *** * **** * * * ** ** ** **** * **
** ****** ** * *** * * * *** >= 1 || input <= 90){
* * * * ** ** * * ***** ****** *** ** ** **** ** * * * * * * **
* *** * * ** **** * *
** * **** ** * * * 0;

}





long long int Fibonacci(int N){
* * ******* **** ** **** i;
* **** * * * * ** long int Array[95] = {0};
*** ** * * * ** = 1;
*** *** ** **** * **** * = 1;
* * * * * ** * ** == 1 || N == 2){
** ** * ** * * ** *** * **** ***** ** ** *** * 1;
** * * * ** * * ***
*** **** * ******* * *
* *** * ***** * * ** * *** * ** * * **** *** i<N; i++){
* ** ** **** * ** * * * *** *** ** * ******* = Array[i-1] + Array[i-2];
* ****** * ** * ** *** ** **** ** *****
** **** * * * * **** ** * * * ** *** ** * * *** Array[N-1];
*** *** * * *******

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
* * * ** * ** * **


* *** *


* * n;
* * int *

int i;
** *** int b;






**** *** ** * **




* ** * * * ** *

if ****
* * ** * * * ***** **

}
** if ****
*** ** * * * * ***

}


* **
*** *** *



}
** * ** *


*** *** * * ***
* 0;}
最新回答 用戶: (-34 分)
0 喜歡 0 不喜歡
內容已隱藏
* ** *** * * * * *


** ****


* * n;
* * ** int *

int i;
*** int b;






* ** * * *** *




** ** * * * *

if *
***** ** ** **** ***

}
*** if *
** * ** *** * * ** *

}


*
* ** * **



}
* * *


* ** * * ** ***
*** 0;}
最新回答 用戶: (-34 分)
0 喜歡 0 不喜歡
內容已隱藏
* * * * * *


* * * **


* * n;
*** * int **

int i;
** * ** int b;






* *** ** * ** * * * *****




*** ** * * *

if * ***
* * ** * * * ** ***

}
** * if ** **
*** *** *** *** *** * * **

}


**
* * ** **



}
* * * *


*** *** * ** * * **
* 0;}
最新回答 用戶: (-34 分)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.195.6
©2016-2025

相關問題

0 喜歡 0 不喜歡
8 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24273 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.2k 瀏覽
0 喜歡 0 不喜歡
6 回答
[正常] 最新提問 4月 21, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 24271 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1k 瀏覽
0 喜歡 0 不喜歡
44 回答
[考試] 最新提問 4月 13, 2017 分類:Midterm |
ID: 23785 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 4.5k 瀏覽
0 喜歡 0 不喜歡
4 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24272 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 881 瀏覽
0 喜歡 0 不喜歡
11 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24270 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.7k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶