计算滞纳金

        static void Main(string[] args)
        {
            var r = abc(2);
            Console.Write(r.Key + "=" + r.Value);
            Console.Read();
        }

        static System.Collections.Generic.KeyValuePair<string,int> abc(int n)
        {
            n = n + 1;
            int k = 25;
            string str = "";
            int r = 0;
            System.Collections.Generic.KeyValuePair<string, int> result;
            for (int i = 1; i < n; i++)
            {
                if (i == 1)
                {
                    str = k.ToString();
                    r = k;
                }
                else
                {
                    r = r + k * i;
                    str = str + "+" + k * i;
                }
                //Console.WriteLine(str);
            }
            result = new KeyValuePair<string, int>(str, r);
            return result;
        }

 

 

posted @ 2013-11-22 13:13  zyip  阅读(108)  评论(0编辑  收藏  举报