Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TargetPractice
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string matrixCordinates = Console.ReadLine();
  14.             string[] matrixCordArr = matrixCordinates.Split(' ');
  15.             char[,] matrix = new char[int.Parse(matrixCordArr[0]), int.Parse(matrixCordArr[1])];
  16.             string input = Console.ReadLine();
  17.             string rowColRadius = Console.ReadLine();
  18.             string[] rowColRadiusArr = rowColRadius.Split(' ');
  19.             int impactRow = int.Parse(rowColRadiusArr[0]);
  20.             int impactCol = int.Parse(rowColRadiusArr[1]);
  21.             int impactRadius = int.Parse(rowColRadiusArr[2]);
  22.             int defaultImpactRadius = int.Parse(rowColRadiusArr[2]);
  23.  
  24.             int count = 0;
  25.             int checker = 0;
  26.  
  27.             for (int row = matrix.GetLength(0) - 1; row >= 0; row--)
  28.             {
  29.                 checker++;
  30.                 if (checker % 2 == 0)
  31.                 {
  32.                     for (int col = 0; col < matrix.GetLength(1); col++)
  33.                     {
  34.                         matrix[row, col] = input[count];
  35.                         count++;
  36.                         if (count == input.Length)
  37.                         {
  38.                             count = 0;
  39.                         }
  40.                     }
  41.                 }
  42.                 else
  43.                 {
  44.                     for (int col = matrix.GetLength(1) - 1; col >= 0; col--)
  45.                     {
  46.                         matrix[row, col] = input[count];
  47.                         count++;
  48.                         if (count == input.Length)
  49.                         {
  50.                             count = 0;
  51.                         }
  52.                     }
  53.                 }
  54.             }
  55.  
  56.             for (int row = 0; row < matrix.GetLength(0); row++)
  57.             {
  58.                 for (int col = 0; col < matrix.GetLength(1); col++)
  59.                 {
  60.                     if ((row - impactRow) * (row - impactRow) + (col - impactCol) * (col - impactCol) <= impactRadius * impactRadius)
  61.                     {
  62.                         matrix[row, col] = ' ';
  63.                     }
  64.                 }
  65.             }
  66.  
  67.             for (int col1 = 0; col1 < matrix.GetLength(1); col1++)
  68.             {
  69.                 for (int row = 0; row < matrix.GetLength(0) - 1; row++)
  70.                 {
  71.                     for (int col = 0; col < matrix.GetLength(1); col++)
  72.                     {
  73.                         if (matrix[row + 1, col] == ' ')
  74.                         {
  75.                             matrix[row + 1, col] = matrix[row, col];
  76.                             matrix[row, col] = ' ';
  77.                         }
  78.                     }
  79.                 }
  80.             }
  81.  
  82.                 for (int row = 0; row < matrix.GetLength(0); row++)
  83.                 {
  84.                     for (int col = 0; col < matrix.GetLength(1); col++)
  85.                     {
  86.                         Console.Write(matrix[row, col]);
  87.                     }
  88.                     Console.WriteLine();
  89.                 }
  90.  
  91.             }
  92.         }
  93.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement