q3601187556 @ 2024-11-14 10:41:44
q=int(input()) str=input() for i in range(1,q+1): str1=input() if int(str1[0])==1: n,s=str1.split(" ") str=str+s print(str) elif int(str1[0])==2: n,a,b=map(int,str1.split(" ")) str=str[a:a+b] print(str) elif int(str1[0])==3: n,a,b=str1.split(" ") a=int(a) ls=list(str) ls.insert(a,b) str="".join(ls) print(str) elif int(str1[0])==4: n,s=str1.split(" ") local=str.find(s) if s in str: print(local) else: print("-1") 在visual studio上结果和测试点1是一致的,但通过不了
by complete_binary_tree @ 2024-11-14 11:03:02
希丰展?用 Markdown
下次提问的时候能把代码用 `````` 包起来吗,像这样:
```cpp
(代码)
```
by complete_binary_tree @ 2024-11-14 11:05:03
哦是 python
那就是这样
```py
(代码)
```
by q3601187556 @ 2024-11-14 15:35:04
q=int(input())
str=input()
for i in range(1,q+1):
str1=input()
if int(str1[0])==1:
n,s=str1.split(" ")
str=str+s
print(str)
elif int(str1[0])==2:
n,a,b=map(int,str1.split(" "))
str=str[a:a+b]
print(str)
elif int(str1[0])==3:
n,a,b=str1.split(" ")
a=int(a)
ls=list(str)
ls.insert(a,b)
str="".join(ls)
print(str)
elif int(str1[0])==4:
n,s=str1.split(" ")
local=str.find(s)
if s in str:
print(local)
else:
print("-1")