问题标题: 酷町堂:4182 字符串截取,查找,替换

0
0
已解决
王文博
王文博
缔造者之神
缔造者之神

60分?????

气**我了!

代码如下:

#pra**a GCC optimize(3)
#pra**a GCC target("avx")
#pra**a GCC optimize("Ofast")
#pra**a GCC optimize("inline")
#pra**a GCC optimize("-fg**e")
#pra**a GCC optimize("-fg**e-lm")
#pra**a GCC optimize("-fipa-sra")
#pra**a GCC optimize("-ftree-pre")
#pra**a GCC optimize("-ftree-vrp")
#pra**a GCC optimize("-fpeephole2")
#pra**a GCC optimize("-ffast-math")
#pra**a GCC optimize("-fsched-spec")
#pra**a GCC optimize("un**ll-loops")
#pra**a GCC optimize("-fali**-jumps")
#pra**a GCC optimize("-fali**-loops")
#pra**a GCC optimize("-fali**-labels")
#pra**a GCC optimize("-fdevirtualize")
#pra**a GCC optimize("-fcaller-saves")
#pra**a GCC optimize("-fc**ssjumping")
#pra**a GCC optimize("-fthread-jumps")
#pra**a GCC optimize("-fun**ll-loops")
#pra**a GCC optimize("-fwhole-p**gram")
#pra**a GCC optimize("-freorder-blocks")
#pra**a GCC optimize("-fschedule-insns")
#pra**a GCC optimize("inline-functions")
#pra**a GCC optimize("-ftree-tail-merge")
#pra**a GCC optimize("-fschedule-insns2")
#pra**a GCC optimize("-fst**ct-aliasing")
#pra**a GCC optimize("-fst**ct-overflow")
#pra**a GCC optimize("-fali**-functions")
#pra**a GCC optimize("-f**e-skip-blocks")
#pra**a GCC optimize("-f**e-follow-jumps")
#pra**a GCC optimize("-fsched-interblock")
#pra**a GCC optimize("-fpartial-inlining")
#pra**a GCC optimize("no-stack-p**tector")
#pra**a GCC optimize("-freorder-functions")
#pra**a GCC optimize("-findirect-inlining")
#pra**a GCC optimize("-fhoist-adjacent-loads")
#pra**a GCC optimize("-frerun-**e-after-loop")
#pra**a GCC optimize("inline-**all-functions")
#pra**a GCC optimize("-finline-**all-functions")
#pra**a GCC optimize("-ftree-switch-conversion")
#pra**a GCC optimize("-foptimize-sibling-calls")
#pra**a GCC optimize("-fexpensive-optimizations")
#pra**a GCC optimize("-funsafe-loop-optimizations")
#pra**a GCC optimize("inline-functions-called-once")
#pra**a GCC optimize("-fdelete-null-pointer-checks")
#pra**a GCC optimize(2)
#include <bits/stdc++.h>
using name** std;
st**ng a,b;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>a;
    b=a.substr(0,3);
    a.erase(0,3);
    int c=a.find(b);
    if(c==-1)
    {
        cout<<-1;
    }
    else
    {
        while(1)
        {
            c=a.find(b);
            if(c==-1) break;
            a.replace(c,3,"cdt");
        }
        cout<<b<<a;
    }
}

 


0
已采纳
李子杰
李子杰
资深光能
资深光能
 1.定义字符串s,并输入;
 2.定义整数x,赋值为 s.寻找(s.截取(0,3),2);
 3.判断(x==-1){
		s="-1";
	}
	否则{
		s.删除(x,3);
		s.**入(x,"cdt");
	}
  4.输出<<s;

 

李子杰在2021-08-04 11:23:21追加了内容

不用火车头!!!

0
我要回答