Пример #1
0
//.#./..#/### => #..#/..../..../#..#";

        static void Main(string[] args)
        {
            Console.WriteLine("Example: " + Solve(s_example, 2));
            Console.WriteLine("Real: " + Solve(ProblemInput.FetchBlocking(s_year, s_day), 5));

            Console.WriteLine("Real 2: " + Solve(ProblemInput.FetchBlocking(s_year, s_day), 18));

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Example: " + Solve(s_example, "abcde"));
            Console.WriteLine("Real: " + Solve(ProblemInput.FetchBlocking(s_year, s_day), "abcdefghijklmnop"));

            Console.WriteLine("Example 2: " + Solve2(s_example, "abcde"));
            Console.WriteLine("Real 2: " + Solve2(ProblemInput.FetchBlocking(s_year, s_day), "abcdefghijklmnop"));

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine(Run(s_example));

            var input = ProblemInput.FetchBlocking(2017, 6);

            Console.WriteLine(Run(input));

            Console.ReadKey();
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine(Run("R2, L3"));
            Console.WriteLine(Run("R2, R2, R2"));
            Console.WriteLine(Run("R5, L5, R5, R3"));
            Console.WriteLine(Run(ProblemInput.FetchBlocking(2016, 1)));
            //	Console.WriteLine(Run2("R8, R4, R4, R8"));
            Console.WriteLine(Run2(ProblemInput.FetchBlocking(2016, 1)));

            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            Console.WriteLine(Solve2(
                                  @"ULL
RRDDD
LURDL
UUUUD"));

            Console.WriteLine(Solve2(ProblemInput.FetchBlocking(2016, 2)));

            Console.ReadKey();
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine(Solve2(
                                  @"pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)"));
            Console.WriteLine(Solve2(ProblemInput.FetchBlocking(2017, 7)));

            Console.ReadKey();
        }
Пример #7
0
        public void Run(int year, int day)
        {
            try
            {
                Console.WriteLine();

                {
                    var input = Example1;
                    var sw    = new Stopwatch();
                    sw.Start();
                    var result = Solve1(input);
                    sw.Stop();
                    Console.Write($"Example 1 ({sw.ElapsedMilliseconds} ms): ");
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(result);
                    Console.ResetColor();
                }

                {
                    var input = ProblemInput.FetchBlocking(year, day);
                    var sw    = new Stopwatch();
                    sw.Start();
                    var result = Solve1(input);
                    sw.Stop();
                    Console.Write($"Real 1 ({sw.ElapsedMilliseconds} ms): ");
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(result);
                    Console.ResetColor();
                }

                Console.WriteLine();

                {
                    var input = Example2;
                    var sw    = new Stopwatch();
                    sw.Start();
                    var result = Solve2(input);
                    sw.Stop();
                    Console.Write($"Example 2 ({sw.ElapsedMilliseconds} ms): ");
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(result);
                    Console.ResetColor();
                }

                {
                    var input = ProblemInput.FetchBlocking(year, day);
                    var sw    = new Stopwatch();
                    sw.Start();
                    var result = Solve2(input);
                    sw.Stop();
                    Console.Write($"Real 2 ({sw.ElapsedMilliseconds} ms): ");
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(result);
                    Console.ResetColor();
                }

                Console.WriteLine();
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.Message);
                Console.WriteLine();

                var lines = e.StackTrace.Split('\n');
                foreach (var line in lines)
                {
                    var s = line.Split(new string[] { "line" }, StringSplitOptions.None);

                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write(s[0]);

                    if (s.Length > 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("line" + s[1]);
                    }
                }

                Console.ReadKey();
            }
        }