예제 #1
0
        public void Test_DayNinePartTwoExample()
        {
            var input = "35\n" +
                        "20\n" +
                        "15\n" +
                        "25\n" +
                        "47\n" +
                        "40\n" +
                        "62\n" +
                        "55\n" +
                        "65\n" +
                        "95\n" +
                        "102\n" +
                        "117\n" +
                        "150\n" +
                        "182\n" +
                        "127\n" +
                        "219\n" +
                        "299\n" +
                        "277\n" +
                        "309\n" +
                        "576";
            var encryption = new XmasEncryption(input, 5);

            Assert.AreEqual(62, encryption.Weakness);
        }
예제 #2
0
        public override long Part1Long()
        {
            XmasEncryption xmas = new XmasEncryption(preamble);

            foreach (var n in numbers)
            {
                if (xmas.IsValid(n))
                {
                    xmas.Add(n);
                }
                else
                {
                    return(n);
                }
            }

            return(-1);
        }
예제 #3
0
        public void Test_DayNinePartOneExample()
        {
            var encryption = new XmasEncryption(_input, 5);

            Assert.AreEqual(127, encryption.Weakpoint);
        }
예제 #4
0
 public Day09() : base(09, 2020, "")
 {
     Encryption = new XmasEncryption(Input, 25);
 }