Sheriff
Здравейте,
Някой има ли решението на тази задача?
https://judge.softuni.bg/Contests/Practice/Index/784#4
Благодаря предварително.
Здравейте,
Някой има ли решението на тази задача?
https://judge.softuni.bg/Contests/Practice/Index/784#4
Благодаря предварително.
Ето още едно решение:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sheriff
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int collumn = 3 * n;
           
            while (n % 2 == 0)
            {
                Console.WriteLine("Само нечетни");
                n = int.Parse(Console.ReadLine());
            }
            
            //FIRST THREE ROWS
            Console.WriteLine("{0}x{0}", new string('.', collumn / 2));
Console.WriteLine("{0}/x\\{0}", new string('.', collumn / 2 - 1));
Console.WriteLine("{0}x|x{0}", new string('.', collumn / 2 - 1));
// First Part of MIDDLE 1
            for (int i = 0; i < (n - 1)/2; i++)
            {
                Console.WriteLine("{0}{1}|{1}{0}", new string('.', (collumn - 1)/ 2 - n - i), new string('x', n + i));
            }
            Console.WriteLine("{0}|{0}", new string('x', collumn / 2));
// Secon Part of MIDDLE 1
            for (int i = 0; i < (n - 1)/ 2; i++)
            {
                Console.WriteLine("{0}{1}|{1}{0}", new string('.', 1 + i), new string('x', (collumn - 3 )/ 2 - i));
            }
// FOOTER
Console.WriteLine("{0}/x\\{0}", new string('.', collumn / 2 - 1));
Console.WriteLine("{0}\\x/{0}", new string('.', collumn / 2 - 1));
            // First Part of MIDDLE 2
            for (int i = 0; i < (n - 1) / 2; i++)
            {
                Console.WriteLine("{0}{1}|{1}{0}", new string('.', (collumn - 1) / 2 - n - i), new string('x', n + i));
            }
            Console.WriteLine("{0}|{0}", new string('x', collumn / 2));
// Secon Part of MIDDLE 2
            for (int i = 0; i < (n - 1) / 2; i++)
            {
                Console.WriteLine("{0}{1}|{1}{0}", new string('.', 1 + i), new string('x', (collumn - 3) / 2 - i));
            }
//Last three rows
Console.WriteLine("{0}x|x{0}", new string('.', collumn / 2 - 1));
            Console.WriteLine("{0}\\x/{0}", new string('.', collumn / 2 - 1));
Console.WriteLine("{0}x{0}", new string('.', collumn / 2));
}
    }
}