提交时间:2024-04-10 13:20:41

运行 ID: 142826

#include<bits/stdc++.h> #define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-')f = -1; c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x == 0){ putchar('0'); return ; } if (x < 0){ putchar('-'); x = -x; } stack <char> s; while (x){ s.push(x % 10 + 48); x /= 10; } while (!s.empty()){ putchar(s.top()); s.pop(); } } inline void DEBUG(){ puts("awa"); } inline void CCF(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); } } using namespace Fast; int a[30]; int charchangeint(char x){ return x - 'a' + 1; } char intchangechar(int x){ return x - 1 + 'a'; } signed main(){ int s,t,w; s = fr(),t = fr(),w = fr(); string str; cin>>str; int n = str.size(); for (int i = 0;i < n;i++)a[i + 1] = charchangeint(str[i]); for (int i = 1;i <= 5;i++){ bool f = false; for (int j = n;j >= 1;j--) if (a[j] + 1 + n - j <= t){ a[j]++; for (int k = j + 1;k <= n;k++)a[k] = a[k - 1] + 1; f = true; break; } if (!f)break; for (int j = 1;j <= n;j++)putchar(intchangechar(a[j])); putchar('\n'); } return 0; }