Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Threading;
- class DiamondTrolls
- {
- static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- checked
- {
- byte numN = byte.Parse(Console.ReadLine());
- int countLines = ((numN - 3) / 2) * 3 + 6;
- int elemOnLine = numN * 2 + 1;
- int halfLines = elemOnLine / 2 + 1;
- int horizLine = countLines - numN;
- for (int row = 1; row <= countLines; row++)
- {
- for (int col = 1; col <= elemOnLine; col++)
- {
- if (row == horizLine || col == halfLines)
- {
- Console.Write("*");
- }
- else if ((row == 1 && col >= (halfLines - numN / 2) && col <= (halfLines + numN / 2))
- || col == (halfLines - numN / 2 - row + 1) || col == (numN + numN / 2 + row))
- {
- Console.Write("*");
- }
- else if (row >= horizLine && (col == row + 1 - horizLine || col == halfLines + countLines - row))
- {
- Console.Write("*");
- }
- else
- {
- Console.Write(".");
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement