示例#1
0
        public void CanFindMyBestPeriod()
        {
            var input = Inputs.Day4.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            var result = Day4.FindBestPeriod(1523, input);

            var Q1 = 1523 * result.Index;

            Assert.Equal(43, result.Index);
            Assert.Equal(65489, Q1);
        }
示例#2
0
        public void CanFindMostSleptPeriod()
        {
            var input = new[]
            {
                "[1518-11-02 00:00] Guard #10 begins shift",
                "[1518-11-01 00:05] falls asleep",
                "[1518-11-02 00:10] wakes up",
                "[1518-11-01 00:00] Guard #10 begins shift",
                "[1518-11-01 00:06] wakes up",
                "[1518-11-02 00:05] falls asleep",
                "[1518-11-05 00:00] Guard #10 begins shift",
                "[1518-11-05 00:15] wakes up",
                "[1518-11-05 00:05] falls asleep",
            };

            var result = Day4.FindBestPeriod(10, input);

            Assert.Equal(5, result.Index);
        }