Beispiel #1
0
        public string SolvePart2(string input)
        {
            for (int i = 0; i < 99; i++)
            {
                for (int j = 0; j < 99; j++)
                {
                    var program = new AlarmProgram()
                    {
                        prog  = input.Split(",").Select(x => int.Parse(x)).ToList(),
                        input = new List <int>()
                        {
                            i, j
                        }
                    };

                    var result = program.Run();
                    if (result == 19690720)
                    {
                        return((100 * i + j).ToString());
                    }
                }
            }

            return(null);
        }
Beispiel #2
0
        public virtual string SolvePart1(string input)
        {
            var program = new AlarmProgram()
            {
                prog  = input.Split(",").Select(x => int.Parse(x)).ToList(),
                input = new List <int>()
                {
                    12, 2
                }
            };

            return(program.Run().ToString());
        }