Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- class Program
- {
- static void Main()
- {
- char[] separators = { ' ', ',' };
- string[] input = Console.ReadLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);
- int[] terrain = new int[input.Length];
- for (int i = 0; i < input.Length; i++) terrain[i] = int.Parse(input[i]);
- JumpingArround(terrain);
- }
- static void JumpingArround(int[] terrain)
- {
- int steps = 0;
- for (int i = 0; i < terrain.Length; i++)
- {
- for (int g = 1; g < terrain.Length; g++)
- {
- int indexPosition = i;
- int currSteps = 1;
- while (terrain[indexPosition] < terrain[(indexPosition + g) % terrain.Length])
- {
- currSteps++;
- indexPosition += g;
- if (indexPosition >= terrain.Length) indexPosition %= terrain.Length;
- }
- if (currSteps > steps) steps = currSteps;
- }
- }
- Console.WriteLine(steps);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement