Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Linq;
- using System.Collections.Generic;
- namespace _03.Present_Delivery
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine().Split('@').Select(int.Parse).ToArray();
- string input = string.Empty;
- int santaIndex = 0;
- while ((input = Console.ReadLine()) != "Merry Xmas!")
- {
- string[] command = input.Split().ToArray();
- if (command[0] == "Jump")
- {
- int lenght = int.Parse(command[1]);
- int size = numbers.Length;
- if (santaIndex + lenght >= numbers.Length)
- {
- santaIndex += lenght;
- while (size < santaIndex)
- {
- size = size + numbers.Length;
- }
- int index = size - santaIndex;
- numbers[index] -= 2;
- santaIndex = 0;
- numbers[santaIndex] -= 2;
- //int test = santaIndex - numbers.Length;
- //santaIndex += test;
- }
- else
- {
- santaIndex += lenght;
- numbers[santaIndex] -= 2; //dali veche ne e 0
- }
- }
- }
- }
- }
- //while (santaIndex > numbers.Length)
- //{
- // if (santaIndex >= numbers.Length)
- // {
- // test = santaIndex - numbers.Length;
- // santaIndex = 0;
- // santaIndex += test;
- // }
- // else
- // {
- // numbers[santaIndex] -= 2;
- // }
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement