亨利.王

只能参数分解

        /// <summary>
        /// 分解参数
        /// </summary>
        /// <param name="num"></param>
        protected void GetParams(int num)
        {
            while (paraNum > 0)
            {
                if (num == 0)
                {
                    paraNum = 0;
                    return;
                }
                if (num == 1)
                {
                    this.paraslst.Add(1);
                    paraNum = 0;
                    return;
                }
                if (num >= Math.Pow(2, paraNum))
                {
                    paraslst.Add(Convert.ToInt32(Math.Pow(2, paraNum).ToString()));
                    GetParams(num - Convert.ToInt32(Math.Pow(2, paraNum).ToString()));
                }
                paraNum--;
            }
        }

posted on 2011-08-01 20:33  亨利.王  阅读(196)  评论(0编辑  收藏  举报

导航