Advertisement
KlimentHristov

Figure.PlaidTowel

Nov 23rd, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.72 KB | None | 0 0
  1. using System;
  2. class PlaidTowel
  3. {
  4.     static void Main()
  5.     {
  6.         int number = int.Parse(Console.ReadLine());
  7.         char oneSym = char.Parse(Console.ReadLine());
  8.         char twoSym = char.Parse(Console.ReadLine());
  9.         int width = number * 4 + 1;
  10.         // first row
  11.         Console.WriteLine("{0}{1}{2}{1}{0}", new string(oneSym, number), new string(twoSym, 1), new string(oneSym, width / 2 - 1));
  12.         // end first row
  13.  
  14.         // second
  15.         int firstDots = number - 1;
  16.         int firstSecondDots = 1;
  17.         int firstThreeDots = (number * 4 + 1) - 4 - (2 * number);
  18.         for (int i = 0; i < number - 1; i++)
  19.         {
  20.             Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}", new string(oneSym, firstDots), new string(twoSym, 1), new string(oneSym, firstSecondDots), new string(oneSym, firstThreeDots));
  21.             firstDots--;
  22.             firstSecondDots += 2;
  23.             firstThreeDots -= 2;
  24.         }
  25.         // end second
  26.  
  27.         // three
  28.         Console.WriteLine("{0}{1}{0}{1}{0}", new string(twoSym, 1), new string(oneSym, width / 2 - 1));
  29.         // end three
  30.  
  31.         // four
  32.         for (int i = 0; i < number - 1; i++)
  33.         {
  34.             firstDots++;
  35.             firstSecondDots -= 2;
  36.             firstThreeDots += 2;
  37.             Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}", new string(oneSym, firstDots), new string(twoSym, 1), new string(oneSym, firstSecondDots), new string(oneSym, firstThreeDots));
  38.  
  39.         }
  40.         Console.WriteLine("{0}{1}{2}{1}{0}", new string(oneSym, number), new string(twoSym, 1), new string(oneSym, width / 2 - 1));
  41.         int twoDots = number - 1;
  42.         int twoSecondDots = 1;
  43.         int twoThreeDots = (number * 4 + 1) - 4 - (2 * number);
  44.         for (int i = 0; i < number - 1; i++)
  45.         {
  46.             Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}", new string(oneSym, twoDots), new string(twoSym, 1), new string(oneSym, twoSecondDots), new string(oneSym, twoThreeDots));
  47.             twoDots--;
  48.             twoSecondDots += 2;
  49.             twoThreeDots -= 2;
  50.         }
  51.         // end second
  52.  
  53.         // three
  54.         Console.WriteLine("{0}{1}{0}{1}{0}", new string(twoSym, 1), new string(oneSym, width / 2 - 1));
  55.         // end three
  56.  
  57.         // four
  58.         for (int i = 0; i < number - 1; i++)
  59.         {
  60.             twoDots++;
  61.             twoSecondDots -= 2;
  62.             twoThreeDots += 2;
  63.             Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}", new string(oneSym, twoDots), new string(twoSym, 1), new string(oneSym, twoSecondDots), new string(oneSym, twoThreeDots));
  64.  
  65.         }
  66.         Console.WriteLine("{0}{1}{2}{1}{0}", new string(oneSym, number), new string(twoSym, 1), new string(oneSym, width / 2 - 1));
  67.  
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement