矩形覆盖
矩形覆盖
http://www.nowcoder.com/questionTerminal/72a5a919508a4251859fb2cfb987a0e6
class Solution {//n=4时候:5种方法,n=5的时候:8种方法,符合裴伯拉且数列
public:
int rectCover(int number) {
int a[number+1],i;
a[1]=1,a[2]=2;
if(number<=2)
{
return number;
}
for(i=3;i<number+1;i++)
{
a[i]=a[i-1]+a[i-2];
}
return a[number];
}
};