Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.66 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 _02.Crocs
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             for (int i = 0; i < n / 2; i++)
  17.             {
  18.                 TopAndBottom(n);
  19.  
  20.             }
  21.  
  22.             SecondPart(n);
  23.  
  24.             for (int i = 0; i < n - 1; i++)
  25.             {
  26.                 MiddlePart(n);
  27.             }
  28.             Console.WriteLine(nPlusOneLine(n));
  29.             SecondPart(n);
  30.  
  31.             for (int i = 0; i < n - (n / 2); i++)
  32.             {
  33.                 Console.WriteLine(nFiveTimes(n));
  34.                 Console.WriteLine(nPlusOneLine(n));
  35.             }
  36.  
  37.             Console.WriteLine(nFiveTimes(n));
  38.  
  39.             for (int i = 0; i < n / 2; i++)
  40.             {
  41.                 TopAndBottom(n);
  42.             }
  43.  
  44.         }
  45.         static void TopAndBottom(int n)
  46.         {
  47.             var topAndBottomSb = new StringBuilder();
  48.             topAndBottomSb.Append(new string(' ', n));
  49.             topAndBottomSb.Append(new string('#', n * 3));
  50.             topAndBottomSb.Append(new string(' ', n));
  51.             Console.WriteLine(topAndBottomSb.ToString());
  52.         }
  53.         static void SecondPart(int n)
  54.         {
  55.             var secondPartSb = new StringBuilder();
  56.             secondPartSb.Append(new string('#', n));
  57.             secondPartSb.Append(new string(' ', n * 3));
  58.             secondPartSb.Append(new string('#', n));
  59.             Console.WriteLine(secondPartSb.ToString());
  60.         }
  61.         static void MiddlePart(int n)
  62.         {
  63.  
  64.             var secondMiddlePartSb = new StringBuilder();
  65.             Console.WriteLine(nPlusOneLine(n));
  66.             secondMiddlePartSb.Append(new string('#', n));
  67.             secondMiddlePartSb.Append(" ");
  68.             secondMiddlePartSb.Append(string.Concat(Enumerable.Repeat(" #", n + (n / 2) - 1)));
  69.             secondMiddlePartSb.Append("  ");
  70.             secondMiddlePartSb.Append(new string('#', n));
  71.  
  72.             Console.WriteLine(secondMiddlePartSb.ToString());
  73.         }
  74.  
  75.          static string nPlusOneLine(int n)
  76.         {
  77.             var middlePartSb = new StringBuilder();
  78.             middlePartSb.Append(new string('#', n));
  79.             middlePartSb.Append(string.Concat(Enumerable.Repeat(" #", n + (n / 2))));
  80.             middlePartSb.Append(' ');
  81.             middlePartSb.Append(new string('#', n));
  82.             return middlePartSb.ToString(); ;
  83.         }
  84.  
  85.         static string nFiveTimes(int n)
  86.         {
  87.             return new string('#', n * 5);
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement