Exemple #1
0
        static Object PartB()
        {
            List <long> input = ReadInputs.ReadLongs(inputPath);

            input.Sort();
            long ans = 0;

            for (int i = 0; i < input.Count; i++)
            {
                for (int j = 0; j < input.Count; j++)
                {
                    if (j != i)
                    {
                        long a = input[i];
                        long b = input[j];
                        long c = 2020 - a - b;
                        if (input.Contains(c))
                        {
                            ans = a * b * c;
                            break;
                        }
                    }
                }
            }
            Console.WriteLine("Part B: Result is {0}", ans);
            return(ans);
        }