示例#1
0
文件: 9.cs 项目: qifanyyy/CLCDSA
        private static string Calculate(int power)
        {
            FixedPoint[] p = new FixedPoint[31];
            p[0] = value;
            for (int i = 1; i < p.Length; i++)
            {
                p[i] = p[i - 1] * p[i - 1];
            }

            FixedPoint result = new FixedPoint("1");

            for (int i = 0; i < p.Length; i++)
            {
                if ((power & (1 << i)) != 0)
                {
                    result *= p[i];
                }
            }

            return(result.IntPart().ToString("000"));
        }