题解 | 小明的字符串
#include <iostream>
using namespace std;
int main() {
int N, T;
cin >> N >> T;
string str;
cin >> str;
while (T --) {
int type, X;
cin >> type >> X;
if (type == 2) {
cout << str[X] << endl;
} else {
string temp_last = str.substr(str.size() - X);
string temp_prv = str.substr(0, str.size() - X);
str = temp_last + temp_prv;
}
}
return 0;
}
// 64 位输出请用 printf("%lld")
查看9道真题和解析