Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class TextBombardment
- {
- static void Main()
- {
- string input = "Well this problem is gonna be a ride.";
- //string input = Console.ReadLine();
- int width = int.Parse(Console.ReadLine());
- string bombList = Console.ReadLine();
- int hight = (int)Math.Ceiling(input.Length / 10.0);
- char[,] arr = new char[hight, width];
- int[] bombColums = Array.ConvertAll(bombList.Split(' '), int.Parse);
- int count = 0;
- for (int row = 0; row < arr.GetLength(0); row++)
- {
- for (int col = 0; col < arr.GetLength(1); col++)
- {
- if (count < input.Length)
- {
- arr[row, col] = input[count];
- count++;
- }
- }
- }
- for (int col = 0; col < arr.GetLength(1); col++)
- {
- bool bomb = false;
- char space = ' ';
- int row = 0;
- for (int i = 0; i < bombColums.Length; i++)
- {
- if (bombColums[i] == col)
- {
- while (row < arr.GetLength(0))
- {
- if (arr[row, col] != space)
- {
- arr[row, col] = space;
- bomb = true;
- }
- else if (bomb == true && arr[row, col] == space)
- {
- break;
- }
- row++;
- }
- row = 0;
- }
- }
- }
- string result = "";
- for (int row = 0; row < arr.GetLength(0); row++)
- {
- for (int col = 0; col < arr.GetLength(1); col++)
- {
- result = result + Convert.ToString(arr[row, col]);
- }
- }
- result = result.TrimEnd();
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement