Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            int max = int.MinValue;

            List <List <int> > allSequences = new List <List <int> >();

            List <int> allNumbers      = new List <int>();
            List <int> longestSequence = new List <int>();

            ConsoleTool.LoadSequence(allNumbers);

            for (int i = 0; i < allNumbers.Count - 1; i++)
            {
                int currentNumber = allNumbers[i];

                i = LoadListOfLists(i, currentNumber, allSequences, allNumbers);
            }

            foreach (var sequence in allSequences)
            {
                if (sequence.Count > max)
                {
                    max             = sequence.Count;
                    longestSequence = sequence;
                }
            }

            Console.WriteLine("Longest sequence is:");
            foreach (var item in longestSequence)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            List <int> sequence = new List <int>();

            ConsoleTool.LoadSequence(sequence);

            Console.WriteLine("Sum of sequence: " + CalculateSum(sequence));
            Console.WriteLine("Average of sequence: " + CalculateAverage(sequence));
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            List <int> sequence = new List <int>();

            ConsoleTool.LoadSequence(sequence);

            sequence.Sort();

            foreach (var item in sequence)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();
        }