Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace BombNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> someList = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse).ToList();
- int[] bombKur = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse).ToArray();
- int startIndex = someList.IndexOf(bombKur[0]);
- while (startIndex != -1)
- {
- int beginIndex = Math.Max(0, startIndex - bombKur[1]);
- int endIndex = Math.Min(someList.Count - 1, startIndex + bombKur[1]);
- someList.RemoveRange(beginIndex, endIndex - beginIndex + 1);
- startIndex = someList.IndexOf(bombKur[0]);
- }
- Console.WriteLine(someList.Sum());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement