#include <bits/stdc++.h> using namespace std; #define ll long long #define rng(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,b) rng(i,0,b) typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef pair<int,int> ii; template<class t> using vc=vector<t>; template<class t> using vvc=vc<vc<t>>; const int MOD = 998244353; ll read(){ ll i; cin>>i; return i; } vi readvi(int n,int off=0,int shift=0){ vi v(n+shift); rep(i,shift)v[i]=0; rep(i,n)v[i+shift]=read()+off; return v; } void YesNo(bool condition, bool do_exit=true) { if (condition) cout << "Yes" << endl; else cout << "No" << endl; if (do_exit) exit(0); } string one_digit_repeat (ll k, string s) { assert(k<10); if (k==0 or s.length() == 0) return ""; if (k==1) return s; return to_string(k) + (s.length() > 1 ? "[" + s + "]" : s); } string repeat (ll k, string s) { if (k==0 or s.length()== 0) return ""; int d = 9; rng(i, 2, 10) if (k % i == 0) d = i; return one_digit_repeat(d, repeat(k/d, s)) + one_digit_repeat(k%d, s); } string solve(ll n) { if (n==0) return ""; if (n==1) return "AE"; string res; res += repeat(n/2,repeat((n+1)/2,"AE") + "A" + repeat((n+1)/2,"C")); res += repeat((n+1)/2, "A"); if (n%2) res += repeat(n/2,"EC") + "E" + repeat (n/2, "A"); res += repeat (2, repeat(n/2-1, "EC") + "E" + solve(n/2-1)); return res; } int main(void ) { ios::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; cout << solve(n) << repeat(n, "C") << endl; return 0; }
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 | #include <bits/stdc++.h> using namespace std; #define ll long long #define rng(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,b) rng(i,0,b) typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef pair<int,int> ii; template<class t> using vc=vector<t>; template<class t> using vvc=vc<vc<t>>; const int MOD = 998244353; ll read(){ ll i; cin>>i; return i; } vi readvi(int n,int off=0,int shift=0){ vi v(n+shift); rep(i,shift)v[i]=0; rep(i,n)v[i+shift]=read()+off; return v; } void YesNo(bool condition, bool do_exit=true) { if (condition) cout << "Yes" << endl; else cout << "No" << endl; if (do_exit) exit(0); } string one_digit_repeat (ll k, string s) { assert(k<10); if (k==0 or s.length() == 0) return ""; if (k==1) return s; return to_string(k) + (s.length() > 1 ? "[" + s + "]" : s); } string repeat (ll k, string s) { if (k==0 or s.length()== 0) return ""; int d = 9; rng(i, 2, 10) if (k % i == 0) d = i; return one_digit_repeat(d, repeat(k/d, s)) + one_digit_repeat(k%d, s); } string solve(ll n) { if (n==0) return ""; if (n==1) return "AE"; string res; res += repeat(n/2,repeat((n+1)/2,"AE") + "A" + repeat((n+1)/2,"C")); res += repeat((n+1)/2, "A"); if (n%2) res += repeat(n/2,"EC") + "E" + repeat (n/2, "A"); res += repeat (2, repeat(n/2-1, "EC") + "E" + solve(n/2-1)); return res; } int main(void ) { ios::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; cout << solve(n) << repeat(n, "C") << endl; return 0; } |