Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleApp6
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int counter = 1;
- int counterMax = 0;
- int position = 0;
- // 4 5 1 2 3 4 5
- for (int i = 0; i < numbers.Length - 1; i++)
- {
- if (numbers[i] < numbers[i + 1])
- {
- counter++;
- if (counter > counterMax)
- {
- counterMax = counter;
- position = i + 1;
- }
- }
- else
- {
- counter = 1;
- }
- }
- int[] result = new int[counterMax];
- for (int i = 0; i < result.Length; i++)
- {
- result[i] = numbers[position - counterMax+1 + i];
- }
- Console.WriteLine(string.Join(' ',result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement