Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class StarRender
- {
- static void Main()
- {
- // Ladies and Gentlemans, look at the ugliest solution I've ever wrote:
- // I have no idea how it even works...
- int n = int.Parse(Console.ReadLine());
- int width = (2 * n + 1);
- int height = (2 * n - (n / 2 - 1));
- int topAndMiddleHeight = n / 2;
- int legsHeight = n / 2 + 1;
- int firstDotsLength = n;
- Console.WriteLine("{0}*{0}", new string('.', n));
- for (int row = 0; row < n / 2-1; row++)
- {
- Console.WriteLine("{0}*{1}*{0}", new string('.', --firstDotsLength), new string('.', 2 * row + 1));
- if (row == n / 2 - 2)
- {
- Console.WriteLine("{0}{1}{0}", new string('*', row + 3), new string('.', n - 1), new string('*', 2 * row + 3));
- }
- }
- for (int row = 0; row < height / 3 - 1; row++)
- {
- int outerDotsCount = row + 1;
- string outerDots = new string('.', outerDotsCount);
- int innerDotsCount = (width - outerDotsCount * 2 - 3) / 2;
- string innerDots = new string('.', innerDotsCount);
- Console.WriteLine("{0}*{1}.{1}*{0}", outerDots, innerDots);
- }
- int legsOuterDotsCount = n / 2;
- int middleDotsCount = n / 2 - 1;
- int legsInnerDotsCount = 0;
- Console.WriteLine("{0}*{1}*{1}*{0}", new string('.', legsOuterDotsCount), new string('.', middleDotsCount));
- for (int row = 0; row < legsHeight - 2; row++)
- {
- legsOuterDotsCount--;
- string outerDots = new string('.', legsOuterDotsCount);
- string middleDots = new string('.', middleDotsCount);
- string innerDots = new string('.', legsInnerDotsCount);
- Console.Write("{0}*{1}*{2}", outerDots, middleDots, innerDots);
- Console.Write(".");
- Console.WriteLine("{2}*{1}*{0}", outerDots, middleDots, innerDots);
- legsInnerDotsCount++;
- }
- Console.WriteLine(
- "{0}{1}{0}",
- new string('*', middleDotsCount+2),
- new string('.', legsInnerDotsCount*2 + 1),
- new string('*', middleDotsCount + 2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement