剑指Offe [10] 矩形覆盖
来源:互联网 发布:java软件开发流程 编辑:程序博客网 时间:2024/06/05 05:31
矩形覆盖 : 我们可以用 2 * 1 的小矩形横着或者竖着去覆盖更大的矩形。请问用 n 个 2 * 1 的小矩形无重叠地覆盖一个2 * n 的大矩形,总共有多少种方法?
思路:
- f(n) = f(n-1)+f(n-2)
package A10矩形覆盖;public class Solution { public int RectCover(int target) { if (target <=0) { return 0; } if (target == 1) { return 1; } int a =1; int b=0; while(target-->0){ a = a+b; b = a-b; } return b; }}
阅读全文
0 0
- 剑指Offe [10] 矩形覆盖
- 剑指offer 10 矩形覆盖
- 《剑指Offer》读书笔记10:矩形覆盖
- 剑指offer(10):矩形覆盖问题
- 《剑指offer》—10、矩形覆盖
- 剑指Offer(10)______矩形覆盖
- 剑指offer题解C++【10】矩形覆盖
- 剑指offer(10)—矩形覆盖
- 牛客网-剑指offer-10-矩形覆盖
- 剑指offer--(10) 矩形覆盖
- 剑指offer--矩形覆盖
- 剑指offer--矩形覆盖
- 《剑指offer》矩形覆盖
- 剑指offer 矩形覆盖
- 《剑指offer》矩形覆盖
- 剑指 offer:矩形覆盖
- 【剑指Offer】矩形覆盖
- 剑指offer10 矩形覆盖
- 位运算--集合的整数表示
- 关于Matlab仿真 Emperor牌奴隶方获胜概率
- css中中文文字对齐和英文文字对齐的办法
- Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationT
- 数组
- 剑指Offe [10] 矩形覆盖
- 性能优化之cache
- springmvc基础知识
- So,这是一篇补丁日记
- HDU 3062 Party 2-sat
- JAVA类加载机制-------初始化
- 短时平均过零率
- 前端性能优化--图片处理(Css Sprites 与 base64)
- 动态规划