Advertisement
Ronka

Untitled

Jun 8th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _8zad
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
  14.  
  15. int currencount = 1;
  16. int maxcount = 0;
  17. int currentelement = 0;
  18. int minelement = int.MinValue;
  19. int start = 0;
  20. int end = 0;
  21.  
  22. for (int i = 1; i < arr.Length; i++)
  23. {
  24. if (arr[i-1] < arr[i])
  25. {
  26. start = i;
  27. currencount++;
  28. currentelement = arr[i - 1];
  29.  
  30. if (maxcount < currencount)
  31. {
  32. end = i;
  33. start = i - currencount;
  34. maxcount = currencount;
  35.  
  36. }
  37.  
  38. }
  39. else
  40. {
  41.  
  42. currencount = 1;
  43. }
  44.  
  45.  
  46. if (maxcount < currencount)
  47. {
  48. minelement = currentelement;
  49. maxcount = currencount;
  50.  
  51. }
  52.  
  53.  
  54.  
  55. }
  56. for (int i = start + 1; i < end + 1; i++)
  57. {
  58. Console.Write(arr[i] + " ");
  59.  
  60.  
  61. }
  62.  
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement