예제 #1
0
        static void Main(string[] args)
        {
            Stopwatch     clock = Stopwatch.StartNew();
            List <double> listOfOccuringIntegers = ParseInequalities.Parse();
            List <double> numbersInInterval      = NumberBetweenIntervals.FindNumberInInvervals(listOfOccuringIntegers);

            listOfOccuringIntegers.AddRange(numbersInInterval);
            listOfOccuringIntegers = listOfOccuringIntegers.OrderBy(x => x).ToList();

            List <string> subset;
            List <string> maxSubset = new List <string>();

            foreach (var line in listOfOccuringIntegers)
            {
                subset = MaximumSubset.FindMaxSubset(line);
                if (maxSubset.Count < subset.Count)
                {
                    maxSubset = subset;
                }
            }

            Console.WriteLine("\nCount of inequalities is: {0}", maxSubset.Count);

            foreach (var item in maxSubset)
            {
                Console.WriteLine(item);
            }

            clock.Stop();
            Console.WriteLine("Solution took {0} ms", clock.ElapsedMilliseconds);

            Console.ReadLine();
        }
예제 #2
0
파일: Program.cs 프로젝트: IvMollov/Exam
        static void Main(string[] args)
        {
            Console.Write("Enter X: ");
            int           x      = int.Parse(Console.ReadLine());
            List <string> result = ParseInequalities.Parse(x);

            Console.WriteLine("\nCount of inequalities is: {0}", result.Count);
            foreach (var item in result)
            {
                Console.WriteLine(item);
            }


            Console.ReadLine();
        }