zoukankan      html  css  js  c++  java
  • [ Algorithm ] N次方算法 N Square 动态规划解决

    public static decimal NSquare(decimal number, int square)
    {
    
        if (square < 0)
        {
            square = -square;
            number = 1 / number;
        }
    
        decimal result = 1;
    
        while (square > 0)
        {
            if (square % 2 == 1) result *= number;
            number *= number;
            square /= 2;
        }
        return result;
    }

    作者:文道
    出处:http://www.cnblogs.com/VincentDao
    关于作者:北漂猴子一枚
    本文版权归作者文道所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接
    如有问题,可以通过邮件my_interface@126.com联系我,非常感谢。

  • 相关阅读:
    fastjson 使用方法
    算法
    SHA算法
    MD5算法
    kindle推送服务
    DLL劫持
    Hook编程
    Hook技术
    权限验证
    虚拟机
  • 原文地址:https://www.cnblogs.com/VincentDao/p/3192517.html
Copyright © 2011-2022 走看看