题目描述:我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?

ac代码:

public class Solution {
    static int str[]=new int[39];
    static {
        str[1]=1;
        str[2]=2;
        for(int i=3;i<39;i++)
        {
            str[i]=str[i-1]+str[i-2];
        }
    }
    public int RectCover(int target) {
         return str[target];
    }
}

 

 posted on 2018-04-11 15:51  几缕清风依旧  阅读(68)  评论(0编辑  收藏  举报