Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. class Program
  4. {
  5.     public static List<char> reversedList = new List<char>();
  6.     static void Main()
  7.     {
  8.        
  9.             double width = double.Parse(Console.ReadLine());
  10.             FirstLine(width);
  11.             SecondLine(width);
  12.             ThirdLine(width);
  13.  
  14.     }
  15.  
  16.     public static void FirstLine(double width)
  17.     {
  18.         int counter = 0;
  19.         for (int i = 0; i < 1; i++)
  20.         {
  21.             for (int j = 1; j <= (width + 3) / 2; j++)
  22.             {
  23.                 if (j % 2 != 0)
  24.                 {
  25.                     Console.Write("#");
  26.                     counter++;
  27.                 }
  28.                 else if (j % 2 == 0 && j == (width + 3) / 2 && counter % 2 == 0)
  29.                 {
  30.                     Console.Write(".");
  31.                 }
  32.                 else
  33.                 {
  34.                     Console.Write("..");
  35.                 }
  36.             }
  37.         }
  38.         Console.WriteLine();
  39.     }
  40.  
  41.     public static void SecondLine(double width)
  42.     {
  43.         int secondCounter = 0;
  44.         int counter = 0;
  45.         for (int i = 0; i < 1; i++)
  46.         {
  47.             for (int j = 1; j <= (width + 3) / 2; j++)
  48.             {
  49.                 if (j % 2 != 0 && j != (width + 3) / 2)
  50.                 {
  51.                     reversedList.Add('.');
  52.                     reversedList.Add('.');
  53.                     Console.Write("..");
  54.                     secondCounter++;
  55.                 }
  56.                 else if (j % 2 != 0 && j == (width + 3) / 2 && counter % 2 == 0)
  57.                 {
  58.                     reversedList.Add('.');
  59.                     Console.Write(".");
  60.                 }
  61.                 else if (j % 2 != 0 && j == (width + 3) / 2 && counter % 2 != 0)
  62.                 {
  63.                     Console.Write(".");
  64.                 }
  65.                 else if (secondCounter % 2 == 0 && j == (width + 3) / 2)
  66.                 {
  67.                     break;
  68.                 }
  69.                 else
  70.                 {
  71.                     reversedList.Add('#');
  72.                     Console.Write("#");
  73.                     counter++;
  74.                 }
  75.             }
  76.         }
  77.         Console.WriteLine();
  78.     }
  79.  
  80.     private static void ThirdLine(double width)
  81.     {
  82.         int secondCounter = 0;
  83.         for (int i = 0; i < 1; i++)
  84.         {
  85.             for (int j = 1; j <= (width + 3) / 2; j++)
  86.             {
  87.                 if (j == 1)
  88.                 {
  89.                     Console.Write(".");
  90.                 }
  91.                 else
  92.                 {
  93.                     if (j % 2 != 0 && j!= (width + 3) / 2)
  94.                     {
  95.                         Console.Write("..");
  96.                         secondCounter++;
  97.                     }
  98.                     else if (j % 2 != 0 && j == (width + 3) / 2 && secondCounter % 2 == 0)
  99.                     {
  100.                         Console.Write(".");
  101.                     }
  102.                     else
  103.                     {
  104.                         Console.Write("#");
  105.                     }
  106.                 }
  107.  
  108.             }
  109.         }
  110.         Console.WriteLine();
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement