Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _04_EasterMaster
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- //int n = 4;
- int totalCols = (3 * n) + 1;
- int eggWidth = (3 * n) - 1;
- int totalRows = 2 * n;
- int topAndBottomSize = n - 1;
- int topAndBottomEmptySpaces = (totalCols - topAndBottomSize) / 2;
- int startSideRow = (totalRows - n) / 2;
- int endSideRow = (totalRows + n) / 2;
- char[,] matrix = new char[totalRows, totalCols];
- //drawing dots everywhere
- for (int row = 0; row < totalRows; row++)
- {
- for (int col = 0; col < totalCols; col++)
- {
- matrix[row, col] = '.';
- }
- }
- //first row empy spaces
- for (int row = 0; row < totalRows; row++)
- {
- for (int col = topAndBottomEmptySpaces; col < topAndBottomSize + topAndBottomEmptySpaces; col++)
- {
- if (row == 0 || row == totalRows - 1)
- {
- matrix[row, col] = '*';
- }
- }
- }
- //printing sides
- for (int row = startSideRow; row < endSideRow; row++)
- {
- for (int col = 0; col < totalCols; col++)
- {
- if (col == 1 || col == totalCols - 2)
- {
- matrix[row, col] = '*';
- }
- }
- }
- //print inside
- for (int col = 3; col < totalCols - 2; col++)
- {
- matrix[totalRows / 2 - 1, col] = '#';
- col++;
- }
- for (int col = 2; col < totalCols - 2; col++)
- {
- matrix[totalRows / 2, col] = '#';
- col++;
- }
- // print side ribbons
- int closeStartRibbon = (totalCols - topAndBottomSize) / 2 - 2;
- int farStartRibbon = (totalCols + topAndBottomSize) / 2 + 1;
- int counter = closeStartRibbon;
- for (int row = 1; row < totalRows; row++)
- {
- for (int col = 1; col <= closeStartRibbon; col++)
- {
- if (col == counter)
- {
- matrix[row, col] = '*';
- counter -= 2;
- }
- }
- }
- counter = farStartRibbon;
- for (int row = 1; row < totalRows; row++)
- {
- for (int col = farStartRibbon; col < totalCols - 2; col++)
- {
- if (col == counter)
- {
- matrix[row, col] = '*';
- counter += 2;
- row++;
- }
- }
- }
- counter = closeStartRibbon;
- for (int row = totalRows - 2; row > 0; row--)
- {
- for (int col = 1; col <= closeStartRibbon; col++)
- {
- if (col == counter)
- {
- matrix[row, col] = '*';
- counter -= 2;
- }
- }
- }
- counter = farStartRibbon;
- for (int row = totalRows - 2; row > 0; row--)
- {
- for (int col = farStartRibbon; col < totalCols - 2; col++)
- {
- if (col == counter)
- {
- matrix[row, col] = '*';
- counter += 2;
- row--;
- }
- }
- }
- //printing matrix
- for (int row = 0; row < totalRows; row++)
- {
- for (int col = 0; col < totalCols; col++)
- {
- Console.Write(matrix[row, col]);
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement