Subject description:
We can use a small rectangle 2 * 1 sideways or vertically to cover a larger rectangle. Will the small rectangle of n 2 * 1 coverage without overlap a large rectangle 2 * n, a total of how many ways?
public class Solution { // similar Fibonacci law of Number of // F (n-) = F (n--. 1) + F (n-2-); public int RectCover ( int target) { IF (target ==. 1 ) { return . 1 ; } IF (target == 2 ) { return 2 ; } int prepreNum =. 1 ; int preNum = 2 ; int RES = 0 ; for ( int I =. 3; I <= target; I ++ ) { RES = prepreNum +penalty; prepreNum = penalty; Prenés = a; } Return res; } }