mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-28 14:11:58 +00:00
parent
8866ee8492
commit
4fec3f5288
31
AtCoder/ABC258/C/C.cpp
Normal file
31
AtCoder/ABC258/C/C.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user