Loop-05. Rabbit reproduction problem, loop-05 rabbit Reproduction
1/* 2 * Main. c 3 * C5-cycle-05. rabbit Breeding Issue 4 * using the Fibonacci series algorithm 5 * Created on: July 25, 2014 6 * Author: boomkeeper 7*8 */9 10 # include <stdio. h> 11 12 int cal (int m) {13 if (m <= 2) 14 return 1; 15 else16 return (m-1) + cal (m-2 )); 17} 18 int main () {19 int amount; // The total logarithm of the rabbit to reach 20 int month = 1; // The number of months 21 22 scanf ("% I ", & amount); 23 while (cal (month) <amount) 24 month ++; 25 printf ("% I \ n", month ); // The rabbit logarithm in the month reaches amount26 27 return 0; 28}
Refer:
Http://sakyone.iteye.com/blog/365325
Question link:
Http://pat.zju.edu.cn/contests/basic-programming/%E5%BE%AA%E7%8E%AF-05
Q: rabbit breeding problems
Rabbit life is 5 ~ In the past 12 years, rabbits have grown up in adulthood in four months. Mating is not suitable immediately at this time, which may easily lead to premature birth and dystocia in female rabbits. Therefore, it is recommended that the breeding process be performed six months later. Rabbits do not have a fixed estrus time, which can be mated and reproduced all year round. However, avoid the high temperature and low temperature season to ensure the survival of young children. Male and female rabbits should be kept separately before mating to ensure that both sides are healthy. During mating, the rabbit will be placed in the same cage, and the rabbit will ride on the mother rabbit to mate. After Successful mating, the rabbit will fall down from the mother rabbit, and The Mating will basically be successful after repeated 3. After successful mating, the breasts and anus of the mother soil will be obviously red and swollen, and the rabbit will be born 30 days later.
Rabbit Breeding Problems
It can be reproduced twice a year. Generally, the first time is three or four, and then there will be more. It is possible that there will be seven, eight, and ninety.