Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 05 / task16_sem3.cpp
blob: bed96162ac419d69604c14565130d783e8269948 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
using namespace std;


int main()
{
	int n;
	cin >> n;


	//up
	for (int i = 0; i < n + 2; i++)
		cout << '#';
	cout << endl;


	for (int i = 0; i < n; i++)
	{
		cout << '#';

		for (int j = i + 1; j <= n + i; j++)
		{
			if (j > n)
				cout << j % n;
			else
				cout << j;

		}
		cout << '#' << endl;
	}
	//mid

	cout << "#";

	for (int i = 0; i < n; i++)
	{
		if (n % 2 == 1 && n / 2 == i)
			cout << "x";
		else if (n % 2 == 0 && ((n / 2 == i) || (n / 2 - 1 == i)))
			cout << "x";
		else
			cout << ' ';
	}

	cout << '#' << endl;


	//down
	for (int i = n - 1; i >= 0; i--)
	{
		cout << '#';

		for (int j = i + 1; j <= n + i; j++)
		{
			if (j > n)
				cout << j % n;
			else
				cout << j;

		}
		cout << '#' << endl;
	}

	for (int i = 0; i < n + 2; i++)
		cout << '#';
	cout << endl;
}