Exemplo n.º 1
0
        protected override String DoSolve(String[] input)
        {
            String lookAndSay    = "";
            String sinput        = "";
            int    maxIterations = 40;

            //read the input
            foreach (String line in input)
            {
                lookAndSay = line;
                sinput     = line;

                for (int i = 0; i < maxIterations; i++)
                {
                    lookAndSay = LookAndSay.ConvertToLookAndSay(lookAndSay);
                }
            }

            return($"After {maxIterations} iterations, the length of the result is {lookAndSay.Length}.");
        }
Exemplo n.º 2
0
        protected override String DoSolve(String[] input)
        {
            String lookAndSay    = "";
            String sinput        = "";
            int    maxIterations = 50;

            //read the input
            foreach (String line in input)
            {
                lookAndSay = line;
                sinput     = line;

                for (int i = 0; i < maxIterations; i++)
                {
                    lookAndSay = LookAndSay.ConvertToLookAndSay(lookAndSay);
                    Console.WriteLine($"Calculation Iteration: {i + 1} Finished with a length of {lookAndSay.Length}.");
                }
            }

            return($"After {maxIterations} iterations, the length of the result is {lookAndSay.Length}.");
        }