0 like 0 dislike
1.9k views

    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

[Exam] asked in Midterm
ID: 24269 - Available when: Unlimited - Due to: Unlimited
| 1.9k views

13 Answers

0 like 0 dislike
Hidden content!
#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;

}
answered by (-48 points)
0 like 0 dislike
Hidden content!
#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;



}
answered by (20 points)
0 like 0 dislike
Hidden content!
#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;

}
answered by (38 points)
0 like 0 dislike
Hidden content!
* * * ** * * *



int ** *



int n;

long long int

int i;
** * long int b;






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

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






* * * **** * * **

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

}

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

}


**
* * * *



}
* **** *



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

}
* 0;}
answered by (-34 points)
0 like 0 dislike
Hidden content!
#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;

}
answered by (44 points)
0 like 0 dislike
Hidden content!
****** **** **



int * **



int n;
long int ***

int i;
** * * long int b;






* ** *** * * * *

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






* ** *****

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

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

}


***
* * *** *



}
** ** **



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

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

}
* * 0;}
answered by (-34 points)
0 like 0 dislike
Hidden content!
#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];
** * **** **** * ***** *

}
answered by (-188 points)
0 like 0 dislike
Hidden content!
***** **** *** * ** *


** *****


n;
* **** int *

int i;
* ** int b;






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




* ** * **** *

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

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

}


** *
*** * ****



}
** * * *


* * ** * ** *** *
** * 0;}
answered by (-34 points)
0 like 0 dislike
Hidden content!
* * *** *****


* ** **


* * n;
* ** ** int *

int i;
* * int b;






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




** * * * * ***

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

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

}


*
** *** *



}
** * * *


** ******** * * ****** ***
* 0;}
answered by (-34 points)
0 like 0 dislike
Hidden content!
* * ** * * ****


* *


* n;
**** int * *

int i;
*** * * int b;






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




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

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

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

}


**
*** ** ** **



}
* ** *


* ** * * ** **** ** * **
* * 0;}
answered by (-34 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.67
©2016-2025

Related questions

0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
0 like 0 dislike
6 answers
[Normal] asked Apr 21, 2017 in Midterm by thopd (12.1k points)
ID: 24271 - Available when: Unlimited - Due to: Unlimited
| 1.2k views
0 like 0 dislike
44 answers
[Exam] asked Apr 13, 2017 in Midterm
ID: 23785 - Available when: Unlimited - Due to: Unlimited
| 4.9k views
0 like 0 dislike
4 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24272 - Available when: Unlimited - Due to: Unlimited
| 956 views
0 like 0 dislike
11 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24270 - Available when: Unlimited - Due to: Unlimited
| 1.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users