Advertisement
braveheart1989

03.IlluminatiLock

Feb 22nd, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 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 _03.IlluminatiLock
  8. {
  9.     class IlluminatiLock
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             Console.Write(new string('.', n) + new string('#', n) + new string('.', n));
  15.             Console.WriteLine();
  16.             Console.Write(new string('.', n - 2) + new string('#', 3) + new string('.', n - 2)
  17.                 + new string('#', 3) + new string('.', n - 2));
  18.             Console.WriteLine();
  19.             int leftPoint;
  20.             int midLeftPoint = 2;
  21.             int midPoint = n-2 ;
  22.             leftPoint = (3 * n - (8 + n)) / 2;
  23.             //Top part of figure:
  24.             for (int row = 2; row < (n + 1) / 2; row++)
  25.             {
  26.                 Console.Write(new string('.', leftPoint));
  27.                 Console.Write(new string('#', 2));
  28.                 Console.Write(new string('.', midLeftPoint));
  29.                 Console.Write(new string('#', 1));
  30.                 Console.Write(new string('.', midPoint));
  31.                 Console.Write(new string('#', 1));
  32.                 Console.Write(new string('.', midLeftPoint));
  33.                 Console.Write(new string('#', 2));
  34.                 Console.Write(new string('.', leftPoint));
  35.                 midLeftPoint += 2;
  36.                 leftPoint -= 2;
  37.                 Console.WriteLine();
  38.             }
  39.  
  40.             //Down part of figure
  41.             midLeftPoint = ((3 * n - (6 + n)) / 2);
  42.             midPoint = n - 2;
  43.             leftPoint = 1;
  44.             for (int row = 2; row < (n + 1) / 2; row++)
  45.             {
  46.                 Console.Write(new string('.', leftPoint));
  47.                 Console.Write(new string('#', 2));
  48.                 Console.Write(new string('.', midLeftPoint));
  49.                 Console.Write(new string('#', 1));
  50.                 Console.Write(new string('.', n - 2));
  51.                 Console.Write(new string('#', 1));
  52.                 Console.Write(new string('.', midLeftPoint));
  53.                 Console.Write(new string('#', 2));
  54.                 Console.Write(new string('.', leftPoint));
  55.                 if (midLeftPoint>0)
  56.                 {
  57.                     midLeftPoint -= 2;
  58.                     leftPoint += 2;
  59.                 }
  60.                 Console.WriteLine();
  61.             }
  62.             Console.Write(new string('.', n - 2) + new string('#', 3) + new string('.', n - 2)
  63.                + new string('#', 3) + new string('.', n - 2));
  64.             Console.WriteLine();
  65.             Console.Write(new string('.', n) + new string('#', n) + new string('.', n));
  66.             Console.WriteLine();
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement