Example #1
0
        public static void Main(string[] args)
        {
            IProblem problem = new Problem44();

            problem.Run();
            Console.ReadLine();
        }
        public void Problem44_Return_Result_5482660()
        {
            long act = Problem44.PentagonNumbers();

            Assert.True(act.Equals(5482660));
        }
Example #3
0
        public static void ReturnsSolution()
        {
            var result = Problem44.Solution(); // pentagonNumber[2167] = 7042750, pentagonNumber[1020] = 1560090

            Assert.AreEqual(5482660, result);
        }
Example #4
0
        public static void Main(string[] args)
        {
            CreateHeader();
            while (true)
            {
                Console.WriteLine("Input problem #:");
                string userInput     = "lis";
                int    problemNumber = 0;

                if (userInput == "sort")
                {
                    SortingAlgorithms SortingAlgorithms = new SortingAlgorithms();
                    SortingAlgorithms.Main();
                }
                else if (userInput == "LinkedList")
                {
                    LinkedListTest linkedList = new LinkedListTest();
                    linkedList.Main();
                }
                else if (userInput == "Fib")
                {
                    Fib fib = new Fib();
                    fib.Main();
                }
                else if (userInput == "lis")
                {
                    LISS lis = new LISS();
                    lis.Main();
                }
                else if (userInput == "search")
                {
                    SearchingAlgorithms search = new SearchingAlgorithms();
                    search.Main();
                }
                else
                {
                    bool validInput = Int32.TryParse(userInput, out problemNumber);
                    if (validInput)
                    {
                        switch (problemNumber)
                        {
                        case 1:
                            Problem1 problem1 = new Problem1();
                            problem1.Main();
                            break;

                        case 21:
                            Problem21 problem21 = new Problem21();
                            problem21.Main();
                            break;

                        case 29:
                            Problem29 problem29 = new Problem29();
                            problem29.Main();
                            break;

                        case 37:
                            Problem37 problem37 = new Problem37();
                            problem37.Main();
                            break;

                        case 44:
                            Problem44 problem44 = new Problem44();
                            problem44.Main();
                            break;

                        case 57:
                            Problem57 problem57 = new Problem57();
                            problem57.Main();
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }