#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void sek(int n, string z)
{
int a = n/9;
int m = n%9;
for (int i = 0; i < a; i++)
cout << "9[" << z << "]";
if (m > 1)
cout << m << "[" << z << "]";
else if (m == 1)
cout << z;
}
void sek(int n, char z)
{
int a = n/9;
int m = n%9;
for (int i = 0; i < a; i++)
cout << "9" << z;
if (m > 1)
cout << m << z;
else if (m == 1)
cout << z;
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
sek(n, 'F');
sek(n, 'B');
while (n > 0)
{
sek(1, 'D');
sek(n-1, 'E');
sek(n-1, "AC");
n--;
}
}
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 | #include <bits/stdc++.h> using namespace std; typedef long long LL; void sek(int n, string z) { int a = n/9; int m = n%9; for (int i = 0; i < a; i++) cout << "9[" << z << "]"; if (m > 1) cout << m << "[" << z << "]"; else if (m == 1) cout << z; } void sek(int n, char z) { int a = n/9; int m = n%9; for (int i = 0; i < a; i++) cout << "9" << z; if (m > 1) cout << m << z; else if (m == 1) cout << z; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; sek(n, 'F'); sek(n, 'B'); while (n > 0) { sek(1, 'D'); sek(n-1, 'E'); sek(n-1, "AC"); n--; } } |
English