Package com. MuMu. ready;
Import java. util. collections;
Public class rabbit {
// Question: classical question: there is a rabbit. every month from the first 3rd months after birth, a rabbit is born. After the third month, a rabbit is born every month. If the Rabbit does not die, what is the total number of rabbits per month?
// 1. program analysis: the rabbit rule is a sequence of numbers 1, 2, 3, 5, 8, 13, 21 ....
Public static void main (string [] ARGs ){
Pipeline can = new pipeline (system. In );
System. Out. println ("Enter the month :");
Int month = can. nextint ();
While (month <1) {// if it is set here, it will only judge once and will not judge the input again.
System. Out. println ("enter the correct month:"); // The correct month is a positive integer greater than 0.
Month = can. nextint ();
}
System. Out. println ("the total number of rabbits in this month is:" + f (month ));
}
Public static int F (INT m ){
If (M <3) return 1;
Else return F (S-1) + f (m-2 );
}
}