矩阵覆盖(斐波那契数列)

题目描述

我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?
斐波那契数列也可以,不想列举更多的解法了
代码如下:
public class Solution {
    public int RectCover(int n) {
    if(n==0) return 0;    
    if(n==1) return 1;
    else if(n==2) return 2;
    return RectCover(n-1)+RectCover(n-2);    
    }
}

猜你喜欢

转载自www.cnblogs.com/cstdio1/p/11233585.html
今日推荐