0 like 0 dislike
3.5k 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 | 3.5k views

44 Answers

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 (20 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



int main()

{
* ** ** * * * * **** * * * *** * ** * *** ** *** * bun10[91][10];
** ** *** ** * * i, n;
*** ** ** * * ** * * ***** ****** * **
** *** * * ** *** ** *** ** * ** **** * **** * * * ** **** * * * *
*** * **** ** ** * **
* * * * * * ***** ** * * * * * &n);
** * * **** ** * **** * * * * * *** ** bun[n-1]);
* * *** * * ** *** * 0;

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

int main(void)

{
* ** *** * * long bun[91]={1,1};
* * ** ** * * *** i, n;
* ***** * * * * * * ** ****
* ** * *** ****** * **** ** * *** ** * * ** * *** * *** * *****
* * * **** * * * *
**** * * * ** * ** ** **** ***** * &n);
** ** * * * ****** * * * *** * * ** ** bun[n-1]);
** * * * * * ** * ** *** 0;

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



int main(){

long long int f[90];

int i;

int n;

long long int b;

for **** *
**** **** ** ** * * * ** **** **
* * * * ** * * * * ***
* * **** ******** * if(i==1)
******* ** * * * * ***
* ** * **** * *** ** ** ** *
**** * *** ****** * * * * *** * ***
** ***** ** * * ** * ** * ** * * * * **** **** ***

}


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


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


*


* * * * * *** *

}

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

#include ** *** *





int main ()

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


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


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


** ** **** ** ****** ** * ** * * N[m-1]);


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



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

#include<stdlib.h>

int main(void)

{
* *** * ** *** ** ** *** num,i;
* * * ** * *** ** **** long long int a[90]={0},b=0;


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

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

#include ** *** **

#include ** ***** *

int main(){
* * * b,d,i;
*** * long int * *
***** **** ** * s[90];
* ** *************** **
**** *** (b==1 || b==2)

{
* * ** * * * ** ****** ***
** **** * * * {
* * * ********** *
** * * * * ** ** **
*** ** ** ** ** **
* * * ** ** *
** ** *
* * * ** * * * * **

}
* * ***
*** * * * return 0;

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

#include * *** ** *

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

int main(){
*** b,d,i;
******** long int a,c,y=1,z=1;
*** * *** s[90];
***** * * *** *** * * * * * **
** *** *** (b==1 || b==2)

{
* *** * ** ** *** * ** ** * **
* * ** {

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

 }

}
** ** ** * * * * * *
******** **** * *** * ** 0;

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

#include<stdlib.h>

#include<math.h>  



int main()

{
*** *** ** ** ** * * time;
**** ** * ** **** * *** *** * long i,j,F0,F1=1,F2=0,sum;
* * *** ***** **** ** * ****** ** ***** *** *** *
* * ** * ** * ** * *** i<time; i++)
**** ** ** ** *
* *** ** * *** ** *** ** *** *** **** * *
***** * * ** ** *** ** ** * **** * ****** ** * **
* *** * ** * * ** *** ****** **** * * * ****
* * **** * ** * * * * ****** * * *
* *** *** * * * ** * * *
* ** *** ** * * **** ****** **** **
*** ** * * * * * ***** 0;

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

#include<stdlib.h>

int main(void)

{
* ****** ****** ** * num,i;
** **** * ****** * *** * long long int a[90]={0},b=0;


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

}
answered by (-412 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.255.43
©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
| 1.4k views
0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 966 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
| 817 views
0 like 0 dislike
70 answers
[Exam] asked Apr 13, 2017 in Midterm
ID: 23789 - Available when: Unlimited - Due to: Unlimited
| 5.4k views
0 like 0 dislike
46 answers
asked Apr 13, 2017 in Midterm by thopd (12.1k points) | 3.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users