0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 13:56:26 +00:00

C - Rotation

https://atcoder.jp/contests/abc258/submissions/32905877
This commit is contained in:
Baoshuo Ren 2022-07-02 20:32:05 +08:00
parent 8866ee8492
commit 4fec3f5288
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

31
AtCoder/ABC258/C/C.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <iostream>
#include <string>
using std::cin;
using std::cout;
const char endl = '\n';
int n, q, cnt;
std::string s;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> q >> s;
while (q--) {
int op, x;
cin >> op >> x;
if (op == 1) {
cnt = (cnt + x) % n;
} else {
x = (x - cnt + n) % n;
cout << s.at(x ? x - 1 : n - 1) << endl;
}
}
return 0;
}