Educational Codeforces Round 119 (Rated for Div. 2)CBA-String

网友投稿 596 2022-10-18 20:10:07

Educational Codeforces Round 119 (Rated for Div. 2)CBA-String

#include#include#include#include#include#includeusing namespace std;typedef long long ll;const double eps = 1e-6;const int N = 2e5 + 10;const int mod = 998244353;vector a;int main () { int t; cin >>t; while(t--) { int n, k; ll x; cin >> n >> k >> x; x --; string s; cin >> s; reverse(s.begin(), s.end()); string temp = ""; int cnt = 0; for (int i = 0; i < n ;i ++) { if (s[i] == 'a') { temp += string(x % (cnt * k + 1), 'b'); x /= (cnt * k + 1); cnt = 0; temp += 'a'; } else { cnt ++; } } temp += string(x % (cnt * k + 1), 'b'); reverse(temp.begin(), temp.end()); cout << temp << endl; } return 0; }

对于A1,A2,A3,A4,...,An。类比过来。基数为k

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:从JDBC attack到detectCustomCollations利用范围扩展
下一篇:简单分数统计
相关文章