编程语言
首页 > 编程语言> > 蓝桥杯算法训练VIP-瓷砖铺放 (C++代码)

蓝桥杯算法训练VIP-瓷砖铺放 (C++代码)

作者:互联网

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int res(int num){
    if(num == 1){
        return 1;
    }
    if(num == 2){
        return 2;
    }
    return res(num-1)+res(num-2);
}
int main()
{
    int n;
    scanf("%d", &n);
    printf("%d",res(n));
    return 0;
}

标签:return,int,res,C++,蓝桥,铺放,num,include
来源: https://www.cnblogs.com/jeseesmith/p/15817285.html