牛客(11)矩形覆盖

//    题目描述
//    我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。
//    请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?
    public static int RectCover(int target) {
        if (target<1){
            return 0;
        }
        if (target==1){
            return 1;
        }
        if (target == 2){
            return 2;
        }
        return RectCover(target-1)+RectCover(target-2);
    }

  

猜你喜欢

转载自www.cnblogs.com/kaibing/p/8994741.html
今日推荐