Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Arrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- List<int> resultList = new List<int>();
- List<int> tempList = new List<int>();
- for(int index = 0; index < nums.Length - 1 ; index++ )
- {
- var currentNum = nums[index];
- var nextNum = nums[index + 1];
- tempList.Add(currentNum);
- while(currentNum < nextNum)
- {
- tempList.Add(nextNum);
- currentNum = nextNum;
- index++;
- if(index == nums.Length - 1)
- {
- continue;
- }
- nextNum = nums[index + 1];
- }
- if(tempList.Count > resultList.Count)
- {
- resultList.Clear();
- resultList.AddRange(tempList);
- }
- tempList.Clear();
- }
- Console.WriteLine(string.Join(" ",resultList));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement