Need some help with a problem with lists

Feb 24 2019 2:55 PM
Hello,
my name is Nikol, and currently, I am learning to code with C#.
 
I should write a program that reads a sequence of numbers and a special bomb number with a certain power. I should detonate every occurrence of the special bomb number and according to its power - his neighbors from left and right. Detonations are performed from left to right, and all detonated numbers disappear. Finally, I should print the sum of the remaining elements in the sequence.
 

1 2 2 4 2 2 2 9

4 2
 
Comment: 

Special number is 4 with power 2. After detontaion we are left with the sequence [1, 2, 9] with sum 12.

1 4 4 2 8 9 1

9 3
Comment:

Special number is 9 with power 3. After detontaion we are left with the sequence [1, 4] with sum 5. Since the 9 has only 1 neighbour from the right we remove just it (one number instead of 3). 

 
I've started doing the program, but I don't understand how to explain all these things to the computer. What I've done -> https://pastebin.com/QqAfNeaX. I know it isn't working. Anyway, I think I should show you what I have tried to do.

Answers (1)