Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _05
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<int> list = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> bomb = Console.ReadLine().Split().Select(int.Parse).ToList();
- for (int i = 0; i < list.Count; i++)
- {
- if (list[i] == bomb[0])
- {
- int bombSpreadStart = Math.Max((i - bomb[1]), 0);
- int bombSpreadEnd = Math.Min((i + bomb[1]), (list.Count-1));
- for (int j = bombSpreadEnd; j >= bombSpreadStart; j--)
- {
- list.RemoveAt(bombSpreadStart);
- }
- i = 0;
- }
- }
- Console.WriteLine(list.Sum());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement