0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 19:12:02 +00:00

P5734 【深基6.例6】文字处理软件

R35887921
This commit is contained in:
Baoshuo Ren 2020-08-01 14:27:35 +08:00 committed by Baoshuo Ren
parent aeb10e48a7
commit 4caca6f202
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
3 changed files with 53 additions and 0 deletions

47
problem/P5734/P5734.cpp Normal file
View File

@ -0,0 +1,47 @@
// https://www.luogu.com.cn/record/35887921
#include<bits/stdc++.h>
using namespace std;
int main() {
int n = 0;
cin >> n;
string s = "";
cin >> s;
for(int i = 0 ; i < n ; i++) {
int act;
cin >> act;
if (act == 1) {
string s1;
cin >> s1;
s += s1;
cout << s;
}
else if (act == 2) {
int st, ed;
cin >> st >> ed;
s = s.substr(st, ed);
cout << s;
}
else if (act == 3) {
int st;
string s1;
cin >> st >> s1;
s.insert(st, s1);
cout << s;
}
else if (act == 4) {
string s1;
cin >> s1;
if(s.find(s1) < s.size()) {
cout << s.find(s1);
}
else {
cout << "-1";
}
}
cout << endl;
}
return 0;
}

BIN
problem/P5734/data/P5734_1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
problem/P5734/data/P5734_1.out (Stored with Git LFS) Normal file

Binary file not shown.