コード例 #1
0
        public static long GetSolutionOfProblem45()
        {
            // The first number is 1, the second is 40755 (as given), so we are looking for the third.
            var count = 3;

            return(TriangleNumberHelper.GetFirstNTriangleNumbersWhichAreAlsoPentagonalAndHexogonal(count).Last());
        }
コード例 #2
0
        public static long GetSolutionOfProblem42()
        {
            // A letter has a value of at most 26.
            // We assume that all words are at most 100 letters long, so max = 26 * 100 = 2600;
            var max = 2600;
            var triangleNumbersBelowMax = TriangleNumberHelper.GetListOfTriangleNumbersBelowMax(max);
            var wordList = TestData.TestData.EnglishWordsProblem42();

            return(wordList.Where(word => triangleNumbersBelowMax.Contains(TestDataHelper.GetWordScore(word))).Count());
        }