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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include<bits/stdc++.h>

using namespace std;

string repeat(string s, long long k) {
    if (k == 0)
        return "";
    if (k == 1)
        return s;
    if (2 <= k and k <= 9)
        return to_string(k) + "[" + s + "]";
    return repeat(repeat(s, k / 9), 9) + repeat(s, k % 9);
}

string draw_width_2_strip_without_stroke(long long n) {
    string seq = repeat("FBFDD", n - 3); 
    seq += "FBFDFDBD";
    return seq;
}

string draw_width_1_strip_without_stroke(long long n) {
    return repeat("FD", n - 1);
}

map<char, char> rotations {
    {'A', 'F'},
    {'B', 'E'},
    {'C', 'D'},
    {'D', 'C'},
    {'E', 'B'},
    {'F', 'A'}
};

string rotate(string x) {
    for (char &c : x) 
        if (c >= 'A' and c <= 'F')
            c = rotations[c]; 
    return x;
}

string draw_1_side_triangle(long long n);
string draw_2_side_triangle(long long n);

string draw_1_side_triangle(long long n) {
    if (n == 1)
        return "A";
    if (n == 2)
        return "AEACA";
    long long l = (n - 1) / 2;
    string subroutine = draw_2_side_triangle(l);
    string ans = repeat(subroutine, 2);
    if (n % 2 == 1)
        ans += draw_width_1_strip_without_stroke(n);
    else 
        ans += draw_width_2_strip_without_stroke(n);
    // draw rhombus
    string rhombus = repeat(repeat("B", l) + repeat("DF", l - 1) + "D", l);
    rhombus += repeat("F", l + 1);
    ans += rhombus;
    if (n % 2 == 0) ans += "F";
    return rotate(ans);
}

string draw_2_side_triangle(long long n) {
    if (n == 1)
        return "FB";
    if (n == 2)
        return "FBFDFBB";
    long long l = (n - 1) / 2;
    string subroutine = draw_1_side_triangle(l);
    string ans = repeat(subroutine, 2);
    // rhombus no. 1
    string rhombus1;
    if (n % 2 == 0)
        rhombus1 = repeat("AAECECE", l);
    else
        rhombus1 = repeat("AECE", l);
    // rhombus no. 2
    string rhombus2 = repeat(repeat("C", l) + repeat("EA", l) + "E", l);
    // rhombus no. 3
    string rhombus3;
    if (n % 2 == 0)
        rhombus3 = 
                repeat("AC", l) + "A" + repeat("E", l + 1) + 
                repeat("AC", l + 1) + "A" + repeat("E", l + 2);
    else
        rhombus3 = repeat("AC", l) + "A" + repeat("E", l + 1);
    ans = ans + rhombus1 + rhombus2 + rhombus3;
    return rotate(ans);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    long long n; cin >> n;
    cout << draw_2_side_triangle(n) + repeat("D", n) << "\n";
}