Advertisement
4valeri

IlluminatiLock

Feb 9th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.08 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.  
  8. class IlluminatiLock
  9. {
  10.     static void Main(string[] args)
  11.     {
  12.         int n = int.Parse(Console.ReadLine());
  13.  
  14.         int width = 3 * n;
  15.         int height = n + 1;
  16.  
  17.         Console.WriteLine("{0}{1}{0}",
  18.             new string('.', n),
  19.             new string('#', n),
  20.             new string('.', n));
  21.  
  22.         int secondPart = n - 2;
  23.  
  24.         Console.WriteLine("{0}###{1}###{0}",
  25.             new string('.', secondPart),
  26.             new string('.', secondPart),
  27.             new string('.', secondPart));
  28.  
  29.         int thirdPartRows = (n - 3) / 2;
  30.         int thirdPart = n - 4;
  31.         int thirdPart2 = 2;
  32.  
  33.  
  34.  
  35.         for (int i = 0; i < thirdPartRows; i++)
  36.         {
  37.             Console.WriteLine("{0}##{1}#{2}#{1}##{0}",
  38.             new string('.', thirdPart),
  39.             new string('.', thirdPart2),
  40.             new string('.', secondPart),
  41.             new string('.', thirdPart2),
  42.             new string('.', thirdPart));
  43.  
  44.             thirdPart -= 2;
  45.             thirdPart2 += 2;
  46.  
  47.         }
  48.  
  49.         int fourthPartRows = (n - 3) / 2;
  50.         int fourthPart = 1;
  51.         int fourthPart2 = n - 3;
  52.  
  53.         for (int i = 0; i < fourthPartRows; i++)
  54.         {
  55.             Console.WriteLine("{0}##{1}#{2}#{1}##{0}",
  56.             new string('.', fourthPart),
  57.             new string('.', fourthPart2),
  58.             new string('.', secondPart),
  59.             new string('.', fourthPart2),
  60.             new string('.', fourthPart));
  61.  
  62.             fourthPart += 2;
  63.             fourthPart2 -= 2;
  64.  
  65.         }
  66.  
  67.     //    Console.WriteLine("{0}{1}{0}",
  68.     //new string('.', n),
  69.     //new string('#', n),
  70.     //new string('.', n));
  71.  
  72.         //int secondPart = n - 2;
  73.  
  74.         Console.WriteLine("{0}###{1}###{0}",
  75.             new string('.', secondPart),
  76.             new string('.', secondPart),
  77.             new string('.', secondPart));
  78.  
  79.         Console.WriteLine("{0}{1}{0}",
  80. new string('.', n),
  81. new string('#', n),
  82. new string('.', n));
  83.  
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement