0 like 0 dislike
5.3k 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 pair 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: 23785 - Available when: Unlimited - Due to: Unlimited

reshown by | 5.3k views

44 Answers

0 like 0 dislike
Hidden content!
#include ** *** **** ***
** *** ** ** ***



int main()

{
* * *** * ** * * * * ** *** long unsigned int N[90] = {0};
***** * * ******** *** **** m, i;


* ** ** *** * ** *** **** * * **
***** * * * ***** * * * = 1;
* ** ** * * *** * ****** = 1;
* ** ** * *** ******** * = 2;
* *** ** * *** * *** ** = 3;


*** * * * **** **** * * ** = 4; i < m; i++)
* * *** **** * * * **** ***** * * * *** * *** ** = N[i-1] + N[i-2];
**** ***** * * **** * * * * * ** *** N[m-1]);


* ** * * * * ** ** * 0;

}
answered by (38 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



int fab(int in);

int main(void)

{


* * * * * * *** ** in;
*** ** * *** * * * **** data[90];
** ** * * * * ** ***** ** * *** ** ***
** * **** ***** ** * i;
*** * *** * * * * *
** **** ** * ** ** *****
* * *** * * * * ** **** *** ** **
*** ***** * **** ** **
* * *** * *** * * * * * **** ** ***** * *** * *** * ***** * ******* *** *
** * ****** ** **** *
*** * ** * * ** * * ** * ** *** ** * ***
* * ** ** *** **** * * 0;

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



int main()

{
* *** * ** ***** ** ** long unsigned int N[90] = {0};
* **** **** * * * *** * m, i;


*** ** * * * ** ***** *** * *** * * * ******
** * * * **** ** ** **** ** = 2;
* ** * ** * **** * ** *** = 2;
** *** *** * **** * = 2;
* ******* * * * * ***** * * = 3;


* **** * * *** * * * *** * = 4; i < m; i++)
**** *** ** * * * ** *** *** *** *** = N[i-1] + N[i-2];
* ** * *** ***** * * * ** * *** **** ** N[m-1]);


***** ** * ** ** *** ** ** * 0;

}
answered by (38 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



int main()

{
* * * **** * ** * * * * *** i, num;
* ***** ** ** * ** long total = 0, rabbit = 1, pairs = 1;


*** ** * ** * ** * * ** * ** * *** *** &num);


* ** * * *** ***** * ** * * = 2; i < num; i++)
* ** * ** ***** * **


** * ****** **** * * *** * * *** * ** * ** = rabbit + pairs;
* ****** **************** * ** *** ** ***** * ** = rabbit;
** * * ****** * * * **** * * **** * ** ** * ** = total;


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


** * **** ******** * ** == 0)
* * *** * * *** ****
*** * ***** * * * * * * * * * * ** * * *** * * *** * ** ******
* ** * * * ** * * * else if(num == 1)
** * * * *** * * *
*** ** * **** * * ** ** ** * * ***** ** ** * * * ** *
*** *** *** * * else if(num == 2)
****** ***** * ** * * ****
*** * ** *** * ** * ** ** * * * ***** * ** * * ** **
* * * *** * ** * **** else{
***** * ***** * * ***** * * * **** * ** *** **** ** * * * *

    }


*** **** * ** * ** * * * 0;

}
answered by (-189 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;


***** ** **** * * * (n == 2)


*** ** * * * * **** **** * * * * * * 1;


* *** *** * *** ** ** * if (n == 1)


** * * * ** *** *** * * ** ** * * ***** 1;


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


********* ** * **** **** ***** * ** * * *** ** ** (count < n)


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


** * ** *** * * ** *** ** ** * ** ****** * * **** * * ** ** = value1 + value2;


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


* **** ** ******* * * * * *** * ** ** * **** ***** * * * * * *** ** * = value2;


** ** * ** * * * * * ** * ** *** **** *** * *** ** * * ** = value3;


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


** * *** *** ** ** **** * * ** * * **** **** * *** value3;



}



int main()



{


* **** *** * **** ** * num;


* * ***** ***** * * ***** *** * ***** &num);


* * * ** *** * ******* **** ***** rabbit(num));


* *** ** * * ** **** ***** 0;



}
answered by (-298 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#define KK 100



int main(void)

{
** ***** ** * *** * *** long int num[KK]={0};
* * * * * * ** *** * n=0,i,j,m;








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


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


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







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



long long first, second, third;

int i;

long long factorial (int n)

{
** * * * * * * * * ** = 1; second = 1; third = 2;
** * * ** * * * ** (n == 1 || n == 2)
** **** * *** ** * * ** * **** *** ** **** **** first;
* *** ** ** ** *** *** if (n == 3)
* * ** * * * * * ****** **** * * * **** * * * * third;
* ** * ******* ** * * *
* * ****** * ** ** * ** * * ***** ***** * **** (i = 2; i < n; i++)
**** ***** * *** **
* ** *** ** * ******* ** ** * * *** ****** = first + second;
* * ***** * ******** ** ** *** * ** * * **** *** = second;
* *** * * ** * ** **** * ** ** ** * = third;
* * *** * * * **


* * * * ******* * * *** * ** third;

}

int main()

{
* * * * * **** * *** * n;
** * * ** * * * *** ** *** &n);
*** ******** * * ** * * * * *** ** * * * *
* ** * * * * * * * * * ** 0;

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



long long first; second; third;

int i;

long long factorial (int n)

{
* ** * *** ** *** *** = 1; second = 1; third = 2;
*** * ** ** * * ** ** * * (n == 1 || n == 2)
****** * ** ** *** * * *** ** *** * * *** * * first;
***** ** ** **** *** if (n == 3)
** *** * * * ** * *** ** * ** * * * third;
* ** * ***** * *** **** *
* *** ** ****** * * * ** * ** * (i = 2; i < n; i++)
* * ** *** *** * * * *
* * ** * * * * *** ***** * ** ******* **** = first + second;
* * * * * * ** ** ** * * ** * * ** ** ** * * = second;
** * * *** ** * * *** * * ** * ***** ** * * * = third;
* **** * * *** **** **


* * ** ** ** ** ** ** third;

}

int main()

{
* * ****** * * * n;
**** *** ** ** *** ** ** ** * ** &n);
* ** ***** * * * ** * *** ***** ** *
* * *** * * *** * * * *** 0;

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



int main(){



int * * *

long long * * *


*** *
** **** *


* * * * * * * * **


** **** ****
* * * * ** *** ** * * * ** * * * * ** + * **




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





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



long long first; second; third;

int i;

long long factorial (int n)

{
* * * * * ******** *** = 1; second = 1; third = 2;
* * * ** * ** * * * (n == 1 || n == 2)
* * **** ** * ** ** * * ** ****** first;
** * * * ** * ***** if (n == 3)
* * * * ** ** ** ** *** * *** * * **** **** * * third;
* *** ** * ** ***** *** * * *
** * * * * * ** ** ** **** * * ** * ** * (i = 2; i < n; i++)
* * ** ** ** * * *
* * * * * * ****** *** * * ** ** * ** * * * * = first + second;
***** * * * * * * * * * ****** ** = second;
** * * * * ** ** ** **** ** **** * ****** **** = third;
*** **** * * ** * ** *


* ***** ** * * * * ** third;

}

int main()

{
** *** ** * *** * n;
* ** **** ** * * * * ** * * * *** ** &n);
** ** * * * * *** * **** *** ** ** *** ** *
* ** *** * **** ** * * **** 0;

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

Related questions

0 like 0 dislike
13 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24269 - Available when: Unlimited - Due to: Unlimited
| 2.1k views
0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 1.5k 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.3k views
0 like 0 dislike
70 answers
[Exam] asked Apr 13, 2017 in Midterm
ID: 23789 - Available when: Unlimited - Due to: Unlimited
| 7.9k views
0 like 0 dislike
46 answers
asked Apr 13, 2017 in Midterm by thopd (12.1k points) | 5.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users