Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int N = int.Parse(Console.ReadLine());
- int D = int.Parse(Console.ReadLine());
- // WITHOUT TRIANGLES
- if (N <= D)
- {
- // upper part
- for (int i = 0; i < N; i++)
- {
- int spacesUp = N * 2 - 1;
- Console.Write(new string('#', i));
- Console.Write(new string('\\', 1));
- Console.Write(new string(' ', spacesUp));
- Console.Write(new string('/', 1));
- Console.WriteLine(new string('#', i));
- spacesUp -= 2;
- }
- // midline
- Console.Write(new string('#', N));
- Console.Write(new string('X', 1));
- Console.WriteLine(new string('#', N));
- // lower part
- int spacesDown = 1;
- for (int i = 0; i < N; i++)
- {
- Console.Write(new string('#', N - 1 - i));
- Console.Write(new string('/', 1));
- Console.Write(new string(' ', spacesDown));
- Console.Write(new string('\\', 1));
- Console.WriteLine(new string('#', N - 1 - i));
- spacesDown += 2;
- }
- }
- // WITH TRIANGLES
- else if (N > D) // N = 5; D = 2
- {
- int countSpaces = D;
- // upper triangle
- for (int i = 1; i <= N - D - 1; i++)
- {
- countSpaces = D;
- int dots = 2 * N - 2 * countSpaces - 3 - 2 * (i - 1);
- Console.Write(new string('#', i - 1)); //
- Console.Write(new string('\\', 1)); //
- Console.Write(new string(' ', countSpaces)); //
- Console.Write(new string('\\', 1)); //
- Console.Write(new string('.', dots));
- Console.Write(new string('/', 1)); //
- Console.Write(new string(' ', countSpaces)); //
- Console.Write(new string('/', 1)); //
- Console.WriteLine(new string('#', i - 1)); //
- }
- // upper mid part
- for (int j = N - D; j <= N; j++)
- {
- int midSpaces = 2 * N - 2 * j + 1;
- Console.Write(new string('#', j - 1));
- Console.Write(new string('\\', 1));
- Console.Write(new string(' ', midSpaces));
- Console.Write(new string('/', 1));
- Console.WriteLine(new string('#', j - 1));
- }
- // midline
- Console.Write(new string('#', N));
- Console.Write(new string('X', 1));
- Console.WriteLine(new string('#', N));
- // lower mid part
- for (int j = N; j >= N - D; j--)
- {
- int midSpaces = 2 * N - 2 * j + 1;
- Console.Write(new string('#', j - 1));
- Console.Write(new string('/', 1));
- Console.Write(new string(' ', midSpaces));
- Console.Write(new string('\\', 1));
- Console.WriteLine(new string('#', j - 1));
- }
- // lower triangle
- for (int i = N - D - 1; i >= 1; i--)
- {
- countSpaces = D;
- int dots = 2 * N - 2 * countSpaces - 3 - 2 * (i - 1);
- Console.Write(new string('#', i - 1)); //
- Console.Write(new string('/', 1)); //
- Console.Write(new string(' ', countSpaces)); //
- Console.Write(new string('/', 1)); //
- Console.Write(new string('.', dots));
- Console.Write(new string('\\', 1)); //
- Console.Write(new string(' ', countSpaces)); //
- Console.Write(new string('\\', 1)); //
- Console.WriteLine(new string('#', i - 1)); //
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement