Daten

05. Mask

Mar 12th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.29 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 Mask
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.  
  15.             var rowWidth = (2 * n) + 2;
  16.  
  17.             //top
  18.             int emptySpaces = n - 2;
  19.             int emptySpacesInside = 0;
  20.  
  21.             for (int i = 0; i < n - 1; i++)
  22.             {
  23.                 Console.WriteLine("{0}/{1}|  |{1}\\", new string(' ', emptySpaces), new string (' ',emptySpacesInside));
  24.                 emptySpacesInside++;
  25.                 emptySpaces--;
  26.             }
  27.  
  28.             Console.WriteLine(new string ('-', rowWidth));
  29.  
  30.             //middle 2 rows
  31.             int emptySpacesMiddleStart = n / 2 - 1;
  32.             int emptySpacesMiddleInside = rowWidth - (emptySpacesMiddleStart * 2) - 4;
  33.             Console.WriteLine("|{0}_{1}_{0}|", new string (' ', emptySpacesMiddleStart), new string (' ', emptySpacesMiddleInside));
  34.             Console.WriteLine("|{0}@{1}@{0}|", new string(' ', emptySpacesMiddleStart), new string(' ', emptySpacesMiddleInside));
  35.  
  36.             //middlemiddle rows
  37.             for (int i = 1; i <= n / 2; i++)
  38.             {
  39.                 int emptySpacesMiddleMiddle = rowWidth - 2;
  40.                 Console.WriteLine("|{0}|", new string(' ', emptySpacesMiddleMiddle));
  41.             }
  42.  
  43.             //mounth + nose
  44.             int emptySpacesAroundNose = (rowWidth - 4) / 2;
  45.             int emptySpacesAroundMounth = (rowWidth - 6) / 2;
  46.             Console.WriteLine("|{0}OO{0}|", new string (' ', emptySpacesAroundNose));
  47.             Console.WriteLine("|{0}/  \\{0}|", new string(' ', emptySpacesAroundMounth));
  48.             Console.WriteLine("|{0}||||{0}|", new string(' ', emptySpacesAroundMounth));
  49.  
  50.             //bottom
  51.             int dashesCount1 = 1;
  52.             int dashesCount2 = 1;
  53.             int dotsCount = rowWidth - 2;
  54.             for (int row = 1; row <= n + 1; row++)
  55.             {
  56.                 Console.WriteLine("{0}{1}{2}", new string('\\', dashesCount1), new string ('`', dotsCount), new string ('/', dashesCount2));
  57.                 dashesCount1++;
  58.                 dotsCount -= 2;
  59.                 dashesCount2++;
  60.             }
  61.         }
  62.     }
  63. }
Add Comment
Please, Sign In to add comment