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;
- int[,] matrix = new int[height, width];
- int x = height / 3;
- int y = width / 2;
- int currentCol = y;
- int currentRow = 0;
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol++;
- currentRow++;
- if (currentRow == x * 2)
- {
- currentCol--;
- currentRow--;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol--;
- currentRow++;
- if (currentCol == y + n / 2 - 1)
- {
- currentCol++;
- currentRow--;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol--;
- if (currentCol == n / 2 + 1)
- {
- //currentCol++;
- //currentRow--;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol--;
- currentRow--;
- if (currentRow == x * 2 - 2)
- {
- currentCol++;
- currentRow++;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol++;
- currentRow--;
- if (currentCol == y + 1)
- {
- currentCol--;
- currentRow++;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentRow++;
- if (currentRow == height)
- {
- currentRow--;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentRow--;
- if (currentRow == x * 2 - 1)
- {
- //currentRow++;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol++;
- if (currentCol == width)
- {
- currentCol--;
- break;
- }
- }
- while (true)
- {
- matrix[currentRow, currentCol] = 1;
- currentCol--;
- if (currentCol == 0)
- {
- currentCol++;
- break;
- }
- }
- for (int row = 0; row < height; row++)
- {
- for (int col = 0; col < width; col++)
- {
- if (matrix[row, col] == 0)
- {
- Console.Write('.');
- }
- if (matrix[row, col] == 1)
- {
- Console.Write('*');
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement