LCP 2-分式化简

    public int[] fraction(int[] cont) {
        int len = cont.length;
        int[] d = new int[]{cont[len - 1], 1};
        while (len > 1) {
            d = get(cont[len - 2], d);
            len--;
        }

        return d;
    }

    private int[] get(int z, int[] c) {
        return new int[]{z * c[0] + c[1], c[0]};
    }

public int[] fraction(int[] cont) {
    int[] res = new int[2];
    res[0] = 1;
    for(int i = cont.length - 1; i >= 0; i--){
        int temp1 = res[1];
        res[1] = res[0];
        res[0] = cont[i] * res[1] + temp1;
    }
    return res;
}

最新文章

  1. Tween公式 以及四个参数
  2. word
  3. c#基础之长度可变类型相同的参数列表
  4. [转]maven安装以及eclipse配置maven
  5. 序列化SerialVersionUID
  6. Git:代码冲突常见解决方法
  7. spring事物传播机制 事物隔离级别
  8. 基于ACE的定时器模板类
  9. ubuntu14.04 为Firefox安装flash插件
  10. Ubuntu上搭建DokuWiki
  11. 新安装Win10
  12. Spring-Mybatis配置多数据源
  13. IDEA-最简单的struts2项目 关于lib项目的默认位置
  14. [Noi2014]购票
  15. 作为JavaScript开发人员,这些必备的VS Code插件你都用过吗?
  16. 【转载】MySQL5.7 添加用户、删除用户与授权
  17. LCD调试1.0
  18. android gradle tools 3.X中dependencies, implementation和compile区别
  19. 12.8 Daily Scrum
  20. pta6-17(另类堆栈)

热门文章

  1. 如何使用Xcode调试Shader代码Bug导致的渲染问题
  2. jvm 内存结构
  3. [javascript] 利用chrome的overrides实时调试线上js
  4. 获取域hash并破解
  5. itest(爱测试) 4.5.0 发布,开源BUG 跟踪管理 & 敏捷测试管理软件
  6. for循环嵌套练习题or99乘法表
  7. MySQL基础(5) | 存储过程
  8. MySQL必知存储引擎
  9. STL中的Set和Map——入门新手篇
  10. python 复习 day1