Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class KaspichaniaBoats
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int width = n * 2 + 1;
- int height = 6 + ((n - 3) / 2) * 3;
- char[,] matrix = new char[height, width];
- FillMatrix(width, height, matrix);
- CenterBotts(n, width, height, matrix);
- FrontBoots(n, width, height, matrix);
- TotalWidthBoot(n, width, height, matrix);
- TopCorpus(n, width, matrix);
- Final(n, width, height, matrix);
- BottomRow(n, width, height, matrix);
- PrintMatrix(width, height, matrix);
- }
- private static void Final(int n, int width, int height, char[,] matrix)
- {
- int leftPivot = 1;
- int rigtPivot = width - 2;
- for (int row = n + 1; row < height - 1; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (col == rigtPivot || col == leftPivot)
- {
- matrix[row, col] = '*';
- }
- }
- leftPivot++;
- rigtPivot--;
- }
- }
- private static void BottomRow(int n, int width, int height, char[,] matrix)
- {
- int LeftRigt = (width - n) / 2;
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (row == height - 1 && (col < LeftRigt || col > LeftRigt + n - 1))
- {
- matrix[row, col] = '.';
- }
- else if (row == height - 1 && (col > LeftRigt || col < LeftRigt + n - 1))
- {
- matrix[row, col] = '*';
- }
- }
- }
- }
- private static void TopCorpus(int n, int width, char[,] matrix)
- {
- int leftPivot = n - 2;
- int rigtPivot = n + 2;
- for (int row = 2; row < n; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (col == leftPivot || col == rigtPivot)
- {
- matrix[row, col] = '*';
- }
- }
- leftPivot--;
- rigtPivot++;
- }
- }
- private static void TotalWidthBoot(int n, int width, int height, char[,] matrix)
- {
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (row == n)
- {
- matrix[row, col] = '*';
- }
- }
- }
- }
- private static void FrontBoots(int n, int width, int height, char[,] matrix)
- {
- for (int row = 1; row < 2; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (row == 1 && (col == n - 1 || col == n + 1))
- {
- matrix[row, col] = '*';
- }
- }
- }
- }
- private static void CenterBotts(int n, int width, int height, char[,] matrix)
- {
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (col == n)
- {
- matrix[row, col] = '*';
- }
- }
- }
- }
- private static void FillMatrix(int width, int height, char[,] matrix)
- {
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- matrix[row, col] = '.';
- }
- }
- }
- private static void PrintMatrix(int widht, int height, char[,] matrix)
- {
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < widht; col++)
- {
- Console.Write(matrix[row, col]);
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement