兔子问题

描述:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月

后每个月又生一对兔子,假如兔子都不死。

问题:问每个月的兔子总数为多少? 

题目分析:兔子的规律为数列1,1,2,3,5,8,13,21….

代码实现:

#include
using namespace std;
//菲波那切数列的实现
int sum(int m){
    int a[10000]={1,1};
    for(int i=2;i>mon){
        int r=sum(mon);
        cout<

    原文作者:魔术师发牌问题
    原文地址: https://blog.csdn.net/sweetsiyumianmian/article/details/72861995
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞