6 like 3 dislike

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

5

88

Output

2

5

1100087778366101931

edited | 47 views
0 0
More clear now then the past one.
1 0
The answer is very big in 6 and 7, so if you just used int or long int isn't available.
0 0
:D they can not see others comment here until they pay for help or have correct answer. So we can discuss below their answer. Thank you :D
1 0

"1<=N<=90 is very important"

I think the hint is enough and clear.

0 0
Called for Help

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

using namespace std;

int main()

{
**** * * **** * long long n, c, first = 0, second = 1, next;

* * * ** * ** * ** ** >> n;
*** * * **** ** ** ** ** *** * ** * * **

* * ** * ** * * ( c = 0 ; c < n ; c++ )
** ** ** *
* * * * ** *** **** *** ** ** ** *** * * * ( c <= 1 )
* ** * * *** * ***** **** ** * * **** ** ***** *** * *** **** = c;
* *** **** ** * ** **** * * *** * * ** *
*** ** ** *** * * *** **** *** *** * * **
* *** * * * ***** * ** * ** **** * * *** * ***** * * ***** = first + second;
****** * *** * ** * ** * * **** ** * ** ** ** *** ** * = second;
*** ** ********** *** * *** * ** * ** * * * ** * * * ******* ** * = next;
* * * ** *** * * ** ** ** **** *** ** *

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

******* ***** * * << next << endl;

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

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

using namespace std;

int main()

{
*** * * *** * ** **** * n;
** * *** * * * ** ** * ** long long a = 0, b = 1, c = 0;
* * * * *** ** * * ** n;
* ****** * **** ** (int i = 0; i != n; ++i)
* **** * * * ** **
* *** * ** ********* * * ** ** ** ** ** = a + b;
* * * * * ** * ** * * * * * * * ****** = b;
* * * ** * * * * **** ***** ****** ** * * = c;
** * * ** **
** **** * ** ** *** ** * ** * * * a ***** * endl;
* ** * ** * * * 0;

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

using namespace std;

int main(void)

{
*** * ********* **** ** ** x,i;
*** * **** *** ***** * * ** long long int f,f1=1,f0=0;
** * *** * * ** * ** * ** *
* * ** ** * ** ****** (x>0 && x<91){
* * * * ** ** *** * ** * * ** ** * ** *** = f1 + f0;
*** ** * * * * **** ** ** * * ** ** * * * ** (i=2; i<= x; i++)
* ** * ** * * ***** ***** * ** * **
* * * *** * * *** ***** ** ** * * * * *** **** ***** ** *** * *** * ** = f1 + f0;
*** * ** * *** ******* * ** **** * * ** * ** ** * * ** ** * * = f1;
** *** * *** ** ** * * *** * * ******* ** *** * * ** ** * ** * = f;
* ** ** * * * * * * * **** *** * *****
* * *** * * * * * * *** * * ** * * << f <<endl;
** * ** * *******
* * *** * * * **** * 0;

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

using namespace std;

int main()

{
*** * ******* * * ** * * long int f[90];
**** * * * ***** m, n;
******* * *** ** ** * ** **** * n;
* * *** **** * = 0;
* * *** ** * **** ** = 1;
** * * ** * * * *** * * ** m<=n; m++)
**** * ** * * ** **********
** * * ** * ***** * * * * ** * *** * * = f[m-2]+f[m-1];
*** * ****** * * *
****** * * * ** ******* * ** * **** * f[n];
* * * **** * *** ** ** 0;

}
answered by (-605 points) 1 flag
0 like 0 dislike
Hidden content!
** *** * * *

using namespace std;

double RabbitPair(double n)

{ double result=0;
** ** * * * oldResult=1;
* * * ** * * * (double i=0;i<n;i++)
* * ** * double temp= result;
** * * **** * * ** ***** * *
** * ** * * *** *** * ** * temp;

}
* *** * * result;

}

int main()

{
* ** ** * * ** ** * * * x,y,z;
* ** * * * ** * *** **** ****** **
*** * **** * ** * * **** * ** * * *
* ** ** * * *** * * * **** ****** **
* * * ** ** ******* * * **** * * *** * * * *
** * * * ** * *** * * *** ** * * * ** ** * ***
***** * * ** * * * * ***** * * ** * ** ** * ****
* ** * * ** ** * * *** *** * *** * * *
* * ** * * *** * ** * * 0;

}
0 0
There are not only 3 case in this question.
You just need "cin>>n;"
0 like 0 dislike
Hidden content!
* * ** * *

using namespace std;

double * * * n)

{ double result=0;
* ** * * * oldResult=1;
* *** (double * *** **** **
* ***** * * double temp= result;
* ** ***** *** * * * * * ** ** *** *
*** * ** * * * * * * temp;
*** **** *
* * * * ** result;

}

int main()

{

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

}
0 0
The output is correct though?? :D :D unless it is user defined input??
0 like 0 dislike
Hidden content!
#include **** * * * ***

using namespace std;

int main()

{
* * *** ** * ** ** * * * * long int f[90];
* *** ** *** ***** *** m, n;
*** ** * ****** ** * *** *** * * n;
* * ** * * * ** = 0;
**** * * * *** * *** = 1;
* * ** * * * ** ** m<=n; m++)
**** *** ** * ****
*** *** ** *** * *** * * ** ** **** ** * = f[m-2]+f[m-1];
* **** * * * * **
****** * * *** ** ** ** * * ** **** f[n];
*** * * * * * ** * * *** 0;

}
0 like 0 dislike
Hidden content!
#include<iostream>

using namespace std;

int main()

{
* *** * *** * * * ** ** long int E,R,B,ERB;
** * ** * *** * ** *
** ** *** * *** * **** * *
* * * * *** ** * * ** * *
** * **** * ** * * **
** * ***** *** ** * *** month;
* * **** **** ** *** * *

int i;
*** * ** *** * ******* ** *** ***
** *** ** ** * ** * * **** ***** ** ** *

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

}
* * ** *** * * * ****** * **
* * *** *** **** ** *** *****
* ** * ** * * ** * *****
** * *** * ** ** * * * * **

}

}
0 like 0 dislike
Hidden content!
#include<iostream>

using namespace std;

int main()

{
* ** *** * * * ** * *** * * long a, i, first=0, second=1, next;
** ****** * ** ****** >> a;

* ** *** ** ** ** ** ** * * * *
* * * **** **** ****** *
* * *** * * **** * ***** * ** * *** ********** * ** * **
* ** * **** **** * ***** ** ** * ** ** *** * = i;
** * * * * * * * ***** * * * * *** * * * **
***** ** ***** * ** ** *** ** ** **
* ** **** * ***** ****** * * * *** * ** **** = first+second;
****** * * * * *** * ** **** * **** * ** * * **** = second;
* * * *** * ** ** * **** * *** ** * ** * * ** = next;
* *** * *** ** * **** * * ** * *** **** * **
** * *** ** ****
*** * *** * * * * ** *** << next;
**** ***** * ***** * ** ** * 0;

}