Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Globalization;
- namespace lab2.Icarus
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- int damageIcarus = 1;
- int startIndex = int.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- while (command != "Supernova")
- {
- string[] tokens = command.Split(' ');
- string direction = tokens[0];
- int steps = int.Parse(tokens[1]);
- switch (direction)
- {
- case "left":
- for (int i = 0; i < steps; i++)
- {
- startIndex--;
- if(startIndex == -1)
- {
- startIndex += input.Count;
- damageIcarus++;
- }
- input[startIndex] -= damageIcarus;
- }
- break;
- case "right":
- for (int i = 0; i < steps; i++)
- {
- startIndex++;
- if (startIndex > input.Count -1)
- {
- startIndex -= input.Count;
- damageIcarus++;
- }
- input[startIndex] -= damageIcarus;
- }
- break;
- }
- command = Console.ReadLine();
- }
- Console.WriteLine(String.Join(" ",input));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement