Files
python/TangDou/CSP-J/AcWingTraining/T5/427.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

23 lines
520 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, n; // 2 ~10
string s;
cin >> a >> b >> n >> s;
a--, b--;
for (int i = 0; i < 5; i++) { // 跑5次
int k = n - 1; // 字符串的最后一位,k是位置
while (k >= 0 && b - (s[k] - 'a') < n - k) k--;
if (k < 0) break;
int c = s[k] + 1; // 长大1个
for (int j = k; j < n; j++)
s[j] = c++;
cout << s << endl;
}
/
return 0;
}