-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path118B Present from Lena.cpp
53 lines (48 loc) · 1.01 KB
/
118B Present from Lena.cpp
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
/*
author : MishkatIT
created : Saturday 2023-03-04-21.42.44
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(_) cout << #_ << " is " << _ << '\n';
using namespace std;
void print(vector<vector<int>>& v, int x)
{
for(int i = 0; i < v.size(); i++)
{
for(int z = 0; z < abs(x); z++)
{
cout << " ";
}
x--;
for(int j = 0; j < v[i].size(); j++)
{
cout << v[i][j] << " \n"[j == v[i].size() - 1];
}
}
}
int main()
{
fio;
int n;
cin >> n;
vector<vector<int>> v;
for (int i = 0; i < n + 1; i++)
{
vector<int> temp;
for (int j = 0; j < (i * 2 + 1); j++)
{
temp.push_back(j - 2 * max(0, j - i));
}
v.push_back(temp);
}
print(v, n);
int sz = v.size();
for (int i = 0; i < sz / 2; i++)
{
swap(v[i], v[sz - i - 1]);
}
v.erase(v.begin());
print(v, -1);
return 0;
}