forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathokviri.cpp
58 lines (49 loc) · 973 Bytes
/
okviri.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
52
53
54
55
56
57
58
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void addframe(vector<string>& v, char c) {
v[0] += "..#.";
v[1] += ".#.#";
v[2] += "#." + string(1,c) + ".";
v[3] += ".#.#";
v[4] += "..#.";
}
void addend(vector<string>& v) {
v[0] += ".";
v[1] += ".";
v[2] += "#";
v[3] += ".";
v[4] += ".";
}
void convert(vector<string>& v, int i) {
v[0][i+2] = '*';
v[1][i+1] = '*';
v[1][i+3] = '*';
v[2][i+0] = '*';
v[2][i+4] = '*';
v[3][i+1] = '*';
v[3][i+3] = '*';
v[4][i+2] = '*';
}
int main() {
string s;
cin >> s;
vector<string> v;
v.resize(5);
// Build initial pattern
for(auto c : s) {
addframe(v, c);
}
addend(v);
// Convert to stars
for(int i = 0; i < s.size(); i++) {
if(i % 3 == 2) {
convert(v, 4 * i);
}
}
// Print answer
for(auto str : v) {
cout << str << endl;
}
}