Пример #1
0
        public void Day13_Example_01()
        {
            var input = @"939
7,13,x,x,59,x,31,19";

            Assert.AreEqual(295, ShuttleSearch.GetEarliestCalculatedTimestamp(input.Split(Environment.NewLine)));
        }
Пример #2
0
Файл: Day13.cs Проект: stefc/AoC
        public void PuzzlePartTwo()
        {
            var actual = ShuttleSearch.WolframAlpha(
                "23,x,x,x,x,x,x,x,x,x,x,x,x,41,x,x,x,x,x,x,x,x,x,829,x,x,x,x,x,x,x,x,x,x,x,x,13,17,x,x,x,x,x,x,x,x,x,x,x,x,x,x,29,x,677,x,x,x,x,x,37,x,x,x,x,x,x,x,x,x,x,x,x,19"
                );

            Assert.Equal("(t+0) mod 23 = 0,(t+13) mod 41 = 0,(t+23) mod 829 = 0,(t+36) mod 13 = 0,(t+37) mod 17 = 0,(t+52) mod 29 = 0,(t+54) mod 677 = 0,(t+60) mod 37 = 0,(t+73) mod 19 = 0", actual);
            // -> "t = 2384517360007913 n + 600689120448303, n element Z"
        }
Пример #3
0
Файл: Day13.cs Проект: stefc/AoC
        public void PuzzlePartOne()
        {
            // Act
            var actual = ShuttleSearch.EarliestBusMultiplyWaitingTime(
                1002632,
                "23,x,x,x,x,x,x,x,x,x,x,x,x,41,x,x,x,x,x,x,x,x,x,829,x,x,x,x,x,x,x,x,x,x,x,x,13,17,x,x,x,x,x,x,x,x,x,x,x,x,x,x,29,x,677,x,x,x,x,x,37,x,x,x,x,x,x,x,x,x,x,x,x,19");

            // Assert
            Assert.Equal(3385, actual);
        }
Пример #4
0
Файл: Day13.cs Проект: stefc/AoC
        public void PuzzleOne()
        {
            // Arrange

            // Act
            var actual = ShuttleSearch.EarliestBusMultiplyWaitingTime(939, "7,13,x,x,59,x,31,19");

            // Assert
            Assert.Equal(295, actual);
        }
Пример #5
0
        static void Main(string[] args)
        {
            var shuttleSearch = new ShuttleSearch(File.ReadAllLines("../input.txt"));

            //Part One
            Console.WriteLine(shuttleSearch.GetEarliestTimeWithOneBus());

            //Part Two
            Console.WriteLine(shuttleSearch.GetFirstConsecutiveTimeAllBusGo());
        }
Пример #6
0
        public void Day13_Full_Test01()
        {
            var data = TestUtil.GetFileContentsAsString("Day13.txt").Split(Environment.NewLine);

            Assert.AreEqual(3385, ShuttleSearch.GetEarliestCalculatedTimestamp(data));
        }
Пример #7
0
        public void Day13_Full_Test02()
        {
            var data = TestUtil.GetFileContentsAsString("Day13.txt").Split(Environment.NewLine);

            Assert.AreEqual(600689120448303, ShuttleSearch.GetLastPart(data[1]));
        }
Пример #8
0
        public void Day13_Example_02()
        {
            var input = @"7,13,x,x,59,x,31,19";

            Assert.AreEqual(1068781, ShuttleSearch.GetLastPart(input));
        }
Пример #9
0
        public void PartOneTest()
        {
            var subject = new ShuttleSearch(GetExampleInput());

            Assert.Equal(295, subject.GetEarliestTimeWithOneBus());
        }
Пример #10
0
        public void PartTwoTest5()
        {
            var subject = new ShuttleSearch(GetExamplePartTwo5());

            Assert.Equal(1202161486L, subject.GetFirstConsecutiveTimeAllBusGo());
        }
Пример #11
0
        public void PartTwoTest3()
        {
            var subject = new ShuttleSearch(GetExamplePartTwo3());

            Assert.Equal(779210, subject.GetFirstConsecutiveTimeAllBusGo());
        }
Пример #12
0
        public void PartTwoTest()
        {
            var subject = new ShuttleSearch(GetExampleInput());

            Assert.Equal(1068781, subject.GetFirstConsecutiveTimeAllBusGo());
        }