C# ACM poj1003

这题很有内涵,先用简单方法

 public static void acm1003(double a)
        {
            if (a==0)
            {
                return;
            }
            double b = 2;
            while (a > 0)
            {
                double c = 1 / b;
                a = a - c;
                b++;
            }
            Console.WriteLine(b - 2 + " card(s)");
        }

 

posted @ 2015-03-13 15:50  BoVoM  阅读(119)  评论(0编辑  收藏  举报