Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _07.Max_Sequence_of_Increasing_Elements
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- var current = 1;
- var longest = 0;
- var startCurrent = input[0];
- var startMax = 0;
- for (int i = 0; i < input.Length - 1; i++)
- {
- if (input[i] < input[i + 1]) current++;
- else
- {
- startCurrent = input[i + 1];
- current = 1;
- }
- if (current > longest)
- {
- startMax = startCurrent;
- longest = current;
- }
- }
- int[] output = new int[longest];
- for (int i = 0; i < longest; i++)
- {
- output[i] = startMax + i;
- }
- Console.WriteLine(String.Join(" ",output));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement