文章

3

粉丝

217

获赞

2

访问

6.9k

头像
提问:1387-查找 不能AC
我要提问
发布于2023年3月17日 14:59
阅读数 2.2k

代码如下,感觉逻辑比较简单,但是不能AC,想问一下是哪里还没有考虑到呢?

 

#include <bits/stdc++.h>

using namespace std;

string reverse(string s,int start,int eend){
    int i=start;
    int j=eend;
    char temp;
    while(i<j){
        temp=s[i];
        s[i]=s[j];
        s[j]=temp;
        i++;
        j--;
    }
    return s;
}


int main()
{
    string s;
    while(cin>>s){
        int n;
        cin>>n;
        for(int i=0;i<n;i++){
            string order;
            cin>>order;
            int start = order[1]-'0';
            int eend = start+order[2]-'0'-1;
  ...

登录查看完整内容


登录后发布评论

2 条评论
admin SVIP
2023年3月17日 15:51

你对替换操作的题意理解有点问题

比如下面这组数据

jkygexrrwunuwxalgcbxistydvrxmfyhb
1
181wtr

正确输出是

jkygexrrwtrunuwxalgcbxistydvrxmfyhb

你的输出是

jkygexrrwtrgcbxistydvrxmfyhb

赞(0)

Mnister_Wu : 回复 admin: 感谢感谢!! replace的参数我理解的有问题

2023年3月17日 20:09