Created
March 7, 2018 20:26
-
-
Save sguzunov/4032cdeaaa66e6dfbed3e6d28d04454b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Paralelepiped | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int n = int.Parse(Console.ReadLine()); | |
int width = (3 * n) + 1; | |
int height = (4 * n) + 4; | |
// Draw top | |
string topRow = "+" + RepeatSymbol('~', n - 2) + "+" + RepeatSymbol('.', width - n); | |
Console.WriteLine(topRow); | |
for (int i = 0; i < (height / 2) - 1; i++) | |
{ | |
string row = "|"; | |
row += RepeatSymbol('.', i); | |
row += "\\"; | |
row += RepeatSymbol('~', n - 2); | |
row += "\\"; | |
row += RepeatSymbol('.', width - (n + i + 1)); | |
Console.WriteLine(row); | |
} | |
// Draw bottom | |
for (int i = 0; i < (height / 2) - 1; i++) | |
{ | |
string row = RepeatSymbol('.', i); | |
row += "\\"; | |
row += RepeatSymbol('.', width - (n + i + 1)); | |
row += "|"; | |
row += RepeatSymbol('~', n - 2); | |
row += "|"; | |
Console.WriteLine(row); | |
} | |
string bottomRow = RepeatSymbol('.', width - n) + "+" + RepeatSymbol('~', n - 2) + "+"; | |
Console.WriteLine(bottomRow); | |
} | |
static string RepeatSymbol(char symbol, int count) | |
{ | |
string result = ""; | |
for (int i = 0; i < count; i++) | |
{ | |
result += symbol; | |
} | |
return result; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment