#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
void prnt(const string &s, ll x)
{
if(x >= 9)
{
cout << "9[";
prnt(s, x/9);
cout << "]";
}
if(s.length() > 1)
{
if(x % 9 > 1)
cout << x%9 << '[' << s << ']';
if(x % 9 == 1)
cout << s;
}
else
{
if(x % 9 > 1)
cout << x%9 << s;
if(x % 9 == 1)
cout << s;
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie();
cout.tie();
cin >> n;
for(int i=n; i>=4; i-=4)
{
prnt("A3[EA]3C", i-3);
cout << "AEAEACCAEACA3E";
prnt("EC", i-4);
cout << "E";
}
if(n % 4 == 0)
{
prnt("C", n);
}
if(n % 4 == 1)
{
cout << "AE";
prnt("C", n);
}
if(n % 4 == 2)
{
cout << "AEACAEE";
prnt("C", n);
}
if(n % 4 == 3)
{
cout << "AEACAEACAEECEAE";
prnt("C", n);
}
cout << "\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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include <bits/stdc++.h> using namespace std; typedef long long ll; ll n; void prnt(const string &s, ll x) { if(x >= 9) { cout << "9["; prnt(s, x/9); cout << "]"; } if(s.length() > 1) { if(x % 9 > 1) cout << x%9 << '[' << s << ']'; if(x % 9 == 1) cout << s; } else { if(x % 9 > 1) cout << x%9 << s; if(x % 9 == 1) cout << s; } } int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n; for(int i=n; i>=4; i-=4) { prnt("A3[EA]3C", i-3); cout << "AEAEACCAEACA3E"; prnt("EC", i-4); cout << "E"; } if(n % 4 == 0) { prnt("C", n); } if(n % 4 == 1) { cout << "AE"; prnt("C", n); } if(n % 4 == 2) { cout << "AEACAEE"; prnt("C", n); } if(n % 4 == 3) { cout << "AEACAEACAEECEAE"; prnt("C", n); } cout << "\n"; } |
English