Advertisement
bullit3189

Crypto Master

Jun 10th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6.  
  7.  
  8. static void Main()
  9. {
  10. var nums = Console.ReadLine()
  11. .Split(new[] { ", " },
  12. StringSplitOptions.RemoveEmptyEntries)
  13. .Select(long.Parse)
  14. .ToList();
  15.  
  16. long seqLength = nums.Count;
  17. long maxLength = 0;
  18.  
  19. for (int step = 1; step < seqLength; step++)
  20. {
  21. for (int stNode = 0; stNode < seqLength; stNode++)
  22. {
  23. var localMax = 1;
  24.  
  25. var currentElementIndex = stNode;
  26. var nextElementIndex = (currentElementIndex + step) % nums.Count;
  27.  
  28. while (nums[nextElementIndex] > nums[currentElementIndex])
  29. {
  30. localMax++;
  31.  
  32. currentElementIndex = nextElementIndex;
  33. nextElementIndex = (currentElementIndex + step) % nums.Count;
  34. }
  35.  
  36. if (maxLength < localMax)
  37. {
  38. maxLength = localMax;
  39. }
  40. }
  41. }
  42.  
  43. Console.WriteLine(maxLength);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement