标签:
public class Solution { public int RectCover(int target) { if(target<=0){ return 0; } if(target==1){ return 1; } if(target==2){ return 2; } //return RectCover(target-1)+RectCover(target-2); // 递归 // 减少耗时 int p = 2; int pp = 1; int c = 0; for(int i=3; i<=target; i++){ c = p+pp; pp = p; p = c; } return c; } }
标签:
原文地址:http://www.cnblogs.com/hesier/p/5582874.html