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

[Exercise] Coding (C) - asked in C
ID: 22018 - Available when: Unlimited - Due to: Unlimited

edited by | 2.8k views

69 Answers

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)
* ** * * * ** * * *** * ** *** * * 2;
** *** * * **** ** *** * if (n == 1)
*** ** * * * * * * * ****** * ** ** * 2;
** * * * **** * ******* *
* ** ** * * **** * ****** *** * ***** (count < n)
* * ** **** * *** ** *** ** * *** * *****
***** * * ***** ** * * ** * ** * * * *** * * ** ** * ** ** = value1 + value2;
*** * ** * * * * * * * *** ** *** *** ** ** ** * * * * ** ***
* * * ** * * *** * *** * *** * * * ** * ** ** * * * * * * = value2;
** ** * * * * ** * *** *** ** * ** **** ** **** *** * *** * * * * = value3;
** ** * *** * * * * ** * * * ** * * *** * * **
* * ** * * *** * * * ** * *** * *** ** * *** value3;

}

int main()

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

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



int main()

{
** * * *** * *** long int value1, value2, value3;
* * * * * * ***** num, count = 1;
* **** **** **** * ** ** ** &num);
*** * *** * ** * * * = 0;
* ** ** * ** * * ** = 1;
*** ** ** * * *** ** ***
* * * * * * *** * (count < num)
***** *** * **** * ** * *
** * **** * ** ******** ** ** ** ********* * * = value1 + value2;
* *** * ** * * *** * * ** ******* *** * *** * * * * *
* * ***** * * ** * *** ** ** * * ** * ******* **** ** = value2;
* ** *** * * ** * * *** ** * ** *** * * *** = value3;
* ** **** ** ** *
** * ****** ** ** *****
** ** ** *** **** *** * ** ****** ** **** value3);
* ** * ** * *** * ** * 0;

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



int main()

{
* ** ********* * ** * * long int value1, value2, value3;
*** * *** * * ** * num, count = 1;
** *** * ** * ** * ** * * * ** **** ** * &num);
** * *** *** * ** ** * * = 0;
* ** ** * ***** * * ** * = 1;
* * * *** * * ** * **
* ** ** * ** *** * (count < num)
**** *** *** * ** ** **
* * * * * * **** * *** ** * **** * * * ** = value1 + value2;
*** * ** * ** **** *** * ** **** ** *** * * * * *
* * ** ** **** * * * ** * * *** ** ***** * * = value2;
** * ** * * ** * ** ** * *** ** * * *** = value3;
***** * * * * ***
* ** * * * * ** **
* **** * ** ********* ** ******* value3);
** * * * ** ** * 0;

}
answered by (-218 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)
* * *** ** ** * * * * * ** * ******* * * * 0;
**** * * * * ** * **** if (n == 1)
* ***** * * * ** ***** *** ****** * ** * * 2;
** * * **** ** *****
* ** * ** ***** * ** *** ** ** * *** ** **** (count < n)
** * * * * *** ** * *** ** ** ** * * ****
* * * * * * *** **** **** ** ** ** ******** * ** ** ** **** * ** * ** = value1 + value2;
** ** ** ** * * *** * * ** * ** * *** ** **** ** ** * * * ** ****
* * * * ****** * ****** ** ** *** * * ***** * * * ** * * *** = value2;
** * * *** ** ** *** * * * * *** ** * * ** ** * * * **** * * * * * * = value3;
***** ** * **** * ****** *** * ** *** * ** * *
** * * ** * ** * *** * * * * * * * ** * ****** value3;

}

int main()

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

}
answered by (-218 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)
**** *** ***** * * ********** ** **** ** * ** * 0;
**** * ***** * * ** * ** *
** * * ** ** **** **** * * * ** * ***** * * * * * (count < n)
* ** * * * * * *** * ***** * **********
** **** * * * * * ***** ** * * ** * **** * * * ** * * **** = value1 + value2;
** *** ** ** * * * ** * * ** ** * * *** * * * *** * *
** ** ***** ****** * * ** * * * * ** ******* **** * * ** ** * **** * = value2;
*** * ** ** * * *** ** ** * * * **** * * * * ** *** ** *** ***** = value3;
* * *** *** * * *** ** * * ** * ***
* * * * *** * *** * * * * ** * value3;

}

int main()

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

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



int **

{
**** * ** long long int *** * * * *
** ** *** * int num, count = 1;
* * * * * * * ** * ** *** * * * *** *
** * * * * * = 0;
** ** ** ** = 1;
* ** ** *

* ****** * * while * * * * * num)
* ** * **** {
* ** * * * * * * * * * * = *** + * *
* ** * ** * *** ****
* * *** ** *** * * ** * = **
* * **** ** *** = *
* ** ** ** * * }
* ** * * *

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

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



int main(void)

{
* * *** * * **** * long int a[90];
*** * ** * ** * ** * ** n,i;
* ** *** **** * **** ** * * *


* * ** ** * * ** * ** *
**** ** * * *** *** * *
** *** * ** ****** *** ** * (i=2; i<90; i++)
** * ** ****** **
**** * ******* *** ** *** ** * * ** * = a[i-1] + a[i-2];
* * * ** ** *** *


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

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



int main(void)

{
* * **** **** *** * long int a[90];
**** * *** ** * ****** n,i;
** **** * * * ** **** * * * *** * * *


* ***** *** *** * ***
***** * **** ** * * *** * **
* ** * * * *** * * * ** (i=2; i<90; i++)
****** * **** ** **** ***
* * * * *** ** **** ** * * * ***** * * * = a[i-1] + a[i-2];
* **** ** * *** * **


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

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



int main(void)

{
** * **** ******** * *** * * *** ** * long int a[90];
* *** **** * * ** p,i;
* ** * ** **** * * * * * * ** * * * *


*** * * * * *** ** **
* *** * ** * ***** ** * * *
* *** * * ** * (i=2; i<90; i++)
**** ** * ** * * *** ****
*** ***** * * * **** * **** * **** = a[i-1] + a[i-2];
*** ** ****** *** **


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

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



int main(void){
* * ** * ** ** ***** * long int a[90];
* * * **** * ** * n,i;
** * ** *** * *** **** ****** ** *
** * ** * * ****** * *** ** **
**** * ** * * * * * ****
* * * *** ** * ** * * (i=2; i<90; i++){
* *** * * ** *** *** * ***** ** * * * * = a[i-1] + a[i-2];}
******* *** ** ** **** * *** * * **** * *
** * ** * ** * ******* * *** * * ** * * * *
* ** * * * *** * * * ** 0;}#include <stdio.h>



int main(void)

{
* ** ***** * ** *** ***** **** long int a[90];
* **** * * ***** **** * n,i;
** ** ** ** **** *** ** * * * * * * *** *** ***


** * * ** *** * * * *
*** * * ** * * * ***
** ** *** **** * * **** * (i=2; i<90; i++)
******** * * ** *** *** *
****** * ** ** * **** ** * * ** * * * * ** * = a[i-1] + a[i-2];
** ** * * * *** * * *


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

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

Related questions

0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Mar 23, 2017 in C
ID: 23262 - Available when: Unlimited - Due to: Unlimited
| 1.5k views
0 like 0 dislike
52 answers
[Exercise] Coding (C) - asked Feb 23, 2017 in C
ID: 22017 - Available when: Unlimited - Due to: Unlimited
| 2.6k views
12,783 questions
183,443 answers
172,219 comments
4,824 users