Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class TextBombardment
- {
- static void Main()
- {
- string input = Console.ReadLine();
- int cols = int.Parse(Console.ReadLine());
- string bombs = Console.ReadLine();
- int rows = input.Length / cols + 1;
- List<char> charList = input.ToList();
- for (int i = 0; i < cols; i++)
- {
- charList.Add(' ');
- }
- char[] charArr = charList.ToArray();
- int[] bombsArr = bombs.Split(' ').Select(int.Parse).ToArray();
- for (int i = 0; i < bombsArr.Length; i++)
- {
- charArr[bombsArr[i]] = ' ';
- bombsArr[i] += cols;
- }
- for (int j = 0; j < rows - 1; j++)
- {
- for (int i = 0; i < bombsArr.Length; i++)
- {
- if (charArr[bombsArr[i]] != ' ')
- {
- charArr[bombsArr[i]] = ' ';
- if (bombsArr[i] + cols <= charArr.Length)
- {
- bombsArr[i] += cols;
- }
- }
- }
- }
- Console.WriteLine(new string(charArr).Trim());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement