Ejemplo n.º 1
0
        // Simulate 1000 steps of interaction in the given star system; get the total energy in it as defined by the task.
        public string PartOne(string[] lines)
        {
            var system = new System1D(lines);

            system.StepTimes(1000);
            return(system.TotalEnergy().ToString());
        }
Ejemplo n.º 2
0
        // Find out after how many steps the star system returns to the initial configuration.
        public string PartTwo(string[] lines)
        {
            var system = new System1D(lines);

            return(Enumerable.Range(0, 3).Select(system.StepAxisUntilSame).Aggregate(1L, LCM).ToString());
        }