Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- /*
- fin = open("input.txt")
- fout = open("output.txt", "w")
- a = []
- b = fin.readlines()
- for r in b:
- l = r.split()
- for i in range(len(l)):
- a.append(int(l[i]))
- n = a[0]
- w = max(a[1:]) * 2 + 1
- h = 0
- for i in range(1, n+1):
- h += a[i] * 2 + 1
- h -= 2
- h += 2
- f = []
- for i in range(h):
- f.append(["."] * w)
- def draw(x, y, d, c):
- i = 0
- while i < d:
- f[x][y+i] = c
- f[x][y-i] = c
- x += 1
- i+=1
- while i >= 0:
- f[x][y+i] = c
- f[x][y-i] = c
- x += 1
- i-=1
- char = ["*", "#"]
- m = w // 2
- t = 0
- for i in range(1, n+1):
- draw(t, m, a[i], char[i % 2])
- t += a[i] * 2 + 1
- t-= 2
- for i in range(h):
- for j in range(w):
- fout.write(f[i][j])
- fout.write("\n")
- fin.close()
- fout.close()
- */
- vector<vector<char>> f;
- int main () {
- // freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- int n;
- cin >> n;
- int a[101];
- int w = 0, h = 0;
- for (int i = 1; i <= n; i++) {
- cin >> a[i];
- w = max(a[i], w);
- h += a[i] * 2 + 1;
- h -= 2;
- }
- h += 2;
- w = w * 2 + 1;
- f.resize(h,vector<char>(w));
- char = ["*", "#"]
- m = w // 2
- t = 0
- for i in range(1, n+1):
- draw(t, m, a[i], char[i % 2])
- t += a[i] * 2 + 1
- t-= 2
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement