Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var arr = Properties.Resources.TextFile1.Split('\n').Select(x => int.Parse(x.Trim())).ToArray();
- int i = 0;
- int steps = 0;
- while(i >= 0 && i < arr.Length)
- {
- i += arr[i]++;
- steps++;
- }
- int answerA = steps;
- steps = 0;
- i = 0;
- arr = arr = Properties.Resources.TextFile1.Split('\n').Select(x => int.Parse(x.Trim())).ToArray();
- while (i >= 0 && i < arr.Length)
- {
- if(arr[i] >= 3)
- i += arr[i]--;
- else
- i += arr[i]++;
- steps++;
- }
- int AnswerB = steps;
Advertisement
Add Comment
Please, Sign In to add comment