コード例 #1
0
ファイル: Program.cs プロジェクト: Pecske/AdventOfCode
        private static void ExecuteDayTwo()
        {
            List <PasswordPolicy> passwordPolicies = DayTwo.ProcessInput();
            int solutionOne = DayTwo.FindPartOneSolution(passwordPolicies);

            int solutionTwo = DayTwo.FindPartTwoSolution(passwordPolicies);

            WriteToConsole(solutionOne, solutionTwo);
        }
コード例 #2
0
        static void DayTwoPartTwo()
        {
            Console.WriteLine("Day 2 Part 2 Output");
            DayTwo dayTwo = new DayTwo();
            string result = dayTwo.PartTwo();

            Console.WriteLine(result);
            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            DayOne day = new DayOne();

            DayTwo two = new DayTwo();

            DayThree three = new DayThree();

            Console.WriteLine(new DayFour().CountValid());
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();

            Day day = new DayTwo();
            var input = File.ReadAllLines("input/day2.txt");
            Console.WriteLine("Result: " + day.Compute(input));

            stopWatch.Stop();
            DisplayDuration(stopWatch);

        }
コード例 #5
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        public static void Main(string[] args)
        {
Begin:
            Console.WriteLine("   ___       _                      _    _____   __  _____             _            _____  _____  __   _____ \r\n / _ \\     | |                    | |  |  _  | / _|/  __ \\           | |          / __  \\|  _  |/  | |  _  |\r\n/ /_\\ \\  __| |__   __  ___  _ __  | |_ | | | || |_ | /  \\/  ___    __| |  ___     `\' / /\'| |/\' |`| |  \\ V / \r\n|  _  | / _` |\\ \\ / / / _ \\| \'_ \\ | __|| | | ||  _|| |     / _ \\  / _` | / _ \\      / /  |  /| | | |  / _ \\ \r\n| | | || (_| | \\ V / |  __/| | | || |_ \\ \\_/ /| |  | \\__/\\| (_) || (_| ||  __/    ./ /___\\ |_/ /_| |_| |_| |\r\n\\_| |_/ \\__,_|  \\_/   \\___||_| |_| \\__| \\___/ |_|   \\____/ \\___/  \\__,_| \\___|    \\_____/ \\___/ \\___/\\_____/\r\n                                                                                                            \r\n                                                                                                            ");
            Console.WriteLine("==================================================");

Start:
            Console.WriteLine("> Please enter the number of the day you want to solve. (1-2)");
            if (int.TryParse(Console.ReadLine(), out var i))
            {
                switch (i)
                {
                case 1:
                    Console.WriteLine($"> The solution to Day 1 (1/2) is '{DayOne.SolvePartOne()}'");
                    Console.WriteLine($"> The solution to Day 1 (2/2) is '{DayOne.SolvePartTwo()}'");
                    break;

                case 2:
                    Console.WriteLine($"> The solution to Day 2 (1/2) is '{DayTwo.SolvePartOne()}'");
                    Console.WriteLine($"> The solution to Day 2 (2/2) is '{DayTwo.SolvePartTwo()}'");
                    break;

                default:
                    Console.WriteLine("> Invalid day entered.");
                    goto Start;
                }
            }
            else
            {
                Console.WriteLine("> Invalid day entered.");
                goto Start;
            }


            Console.WriteLine("\n> Press any key to view other solutions.");
            Console.ReadKey();
            Console.Clear();
            goto Begin;
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("What day of the advent calender would you like to solve?");
            int advInt;

            int.TryParse(Console.ReadLine(), out advInt);
            switch (advInt)
            {
            default:
                break;

            case 1:
                DayOne.StartProblem();
                break;

            case 2:
                DayTwo.StartProblem();
                break;

            case 3:
                DayThree.StartProblem();
                break;
            }
        }
コード例 #7
0
        private static int DayTwoTwo()
        {
            var inp = InputProvider.DayTwo();

            return(DayTwo.ProblemTwo(inp, 19690720));
        }
コード例 #8
0
        private static int DayTwoOne()
        {
            var inp = InputProvider.DayTwo();

            return(DayTwo.ProblemOne(inp, 12, 2)[0]);
        }