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

69 Answers

0 like 0 dislike
Hidden content!
* ** *** * ** **



int main()

{

int n,i;

long long ** * *


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


* * = 1;
* ** = 1;




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


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





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

int main()

{
*** * * * ** * ** n, i;
* ** ** * * * * * ** long fn[90]={1,1};
* * ***** ***** * * a1=1, a2=1;


* * **** * * ** *** **** * * &n);


*** ****** **** * * * ** i<n; i++)
* *** * * * ** *****
* * ** * **** ** * ** ** *** *** ** **** ** ** * *** *
* * * ** ***** *** ** *


* * **** ** * * * * ** ** * * * * ** fn[n-1]);
* * * ** * ** * ** * * 0;

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

#include<stdlib.h>



int main(){
* *** ** **** * *** * * * * long int a[90];
* * ** * * **** ** ** input;
** ** * * ****** * ** i;
** *** ** * * * p;
** * * * *** * * * * *** * * * *** *
* * ****** * ** ** * * * * ** ** = 0;
*** * **** ****** * * **
* ** ** *** **** = 1;
* * * * * * *** * * = 1;
** * * * ** * ** ** * * * * * *
* * * **** *** ** *** * ** * * * = a[i-2] + a[i-1];
** * * ** ****** **** *

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

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

int main()

{
*** ** ** * * ** * long int n, a1=0, a2=1, a3=1, i;
** *** * ** * * * * **** * ** ** * ** &n);
** * * * **** * *** * *** i<=n; i++)
** * ** **** *** *
** ** * * *** * * *** *** * ** **** * * *** * *
* ****** * * * *** * * * * ** * **** ** *
******* ** ****** **** * ** * * **** * * * ** * **
* *** * ***


** ** ** * **** * **** * * **** ** * ** a3);


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

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



int * * ****



int main()

{
** * * ** ** n, i = 0, c;


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

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




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




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

}



int Fibonacci(int n)

{
* * * ** * ** ( n == 0 )
** * * ***** *** * * ** * ** * ** 0;
* ** * ** * * * * if ( n == 1 )
* ***** * * * ** **** ** *** * * ** * * * 1;
** ***** * ** * ** **
**** *** ** * * ***** * * * *** ** ( ****** ** + Fibonacci(n-2) );

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



int **********



main()

{
* *** * ** * ** **** n, i = 0, c;


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

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




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




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

}



int Fibonacci(int n)

{
* * * **** *** * ( n == 0 )
* * * * *** * * ******* ** * 0;
* * ** * * ** * * if ( n == 1 )
* * ** *** * ** * * ** * ** 1;
*** * ***** **
* ***** ** **** * * * *** * ** ( Fibonacci(n-1) + *** * );

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

#include<stdlib.h>



int main(){
** * **** * ** ** * ** long int a[90];
*** * * * ** * *** * p;
***** * * ***** ** * * * ***
** * * * ** * ** * **** ** ** * * *** = 0;
** * ** * * ** ***
* **** * *** * * ** * ** = 1;
* * * ** * ** * * * * * = 1;
* ** **** ** ** * *** * i;
** ****** ** * * * ** *** *** *
*** ** ** * ** * * * * * * * * * = a[i-2] + a[i-1];
**** * * ** * *** *** * *
*** ** ** *** * * long int input;
** ** ** * ** *** ** *** ** * **** ****
*** ***** **** ***** ** * * **** *** *** *
****** * *********** * ***** * 0;

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

#include<string.h>

long long int n(long long int m)

{
* * ** ** **** * **** ***
* * * * ** **** ** ***** ** ** * ** * * * ** * * 1;
*** * ** *** * ** **** ** * if(m==0)
** * * ** ** *** * ** * *** ***** * **** * ** ** * 1;
* * ** * * ** * *
* * * * * ** * * ***** * * * ** ***** n(m-1)+n(m-2);



}



int main(void)

{
** * ** ** ** * ** long int m;


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




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

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



int main()

{

    int n,first,second,i,newNum;

    scanf("%d",&n);

    if(n>=1 && n<=90)
* ** * * * * * * **** *** * **** * *
*** * ** ** * ** *** * ********* * *** *** * == 0)
** *** ** * * ** ** ******* *** **** ***** *** ** ** *** * ** ** **** * * ** * * *
* * * * * * *** **** * * * * ** * * * ** if(n == 1)
* ** * * ** **** **** * * ** ** * * * * ***** * * * * * * * ***** * *** * *** ***
** ** * * * ** *** *** * *** * * * **
** ***** * * * ** *** * ** ** * ****** * **
* * ** ** * * **** ***** * ** * **** ******** *** * = 0;
* ** * * *** * *** * ** ***** * * * ** **** * ** ***** * * ** = 1;
*** *** ** ** ** * *** * * * ** *** * * *** ** *** * ** ********** * = 2; i <= n; i++)
* ** * ** * *** ** ** * * ***** * * *** *** * ** * * ** * **** * * ** *
* ** ** * ** * * * * * **** ****** * ** * * * ** ** * * **** * * **** ** * * * = first + second;
** * * *** * * ***** * ** * * * * * *** * ****** * *** * ** * * ** *** **** * = second;
*** ** ***** ** ** ** ***** * ** * * ** * ** ** * * * * *** ** * ** * ** * * *** = newNum;
*** *** ** *** **** ** **** ** * * ******* ** ** **** ** * * * **
***** * * * * ****** ** ** * **** ** * ** * *** * * * ** * * * ** * *** * ** ***
** ***** *** * ** * * **** * * * * *



    }

    return 0;

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

#include<stdlib.h>



int main(){
** * * * * ** ** *** long int a[90];
* * * ** * * * *** p;
* **** * *** ** ****** * * * * * ****
** * * * * * * * *** * * * * * **** * = 0;
* * * ** ** ** * ** *
** * * * ** * * * ** ** = 1;
* ** * ** * * * * * ** = 1;
*** ** ** * * ****** * * * * i;
* * * * * * * * * * * ** **
*** * * * * ** * **** ** * * * ** ** * * = a[i-2] + a[i-1];
** * ** * ** * *
** * ** ** * * * long int input;
* ***** * ** * *** ** ***** **** * ** * ****** *** *** * *
*** * *** * *** * * ******** ***** * * ** ***
* **** *** * *** ** * * *** 0;

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

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.8k views
0 like 0 dislike
52 answers
[Exercise] Coding (C) - asked Feb 23, 2017 in C
ID: 22017 - Available when: Unlimited - Due to: Unlimited
| 3.1k views
12,783 questions
183,443 answers
172,219 comments
4,824 users