fzu校赛B题

题目链接:http://acm.fzu.edu.cn/contest/problem.php?cid=129&sortid=2

思路:一开始思路有点混乱,然后仔细一看数据,发现暴力即可。

View Code
 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<string>
 5 using namespace std;
 6 const int MAXN=50005;
 7 char s3[MAXN];
 8 int num[MAXN];
 9 
10 int main(){
11     char s1[110],s2[110];
12     while(gets(s1)){
13         int len=strlen(s1),k=0;
14         for(int i=0;i<len;i++){
15             if(s1[i]>='A'&&s1[i]<='Z')s1[i]=s1[i]-'A'+'a';
16         }
17         
18         gets(s2);
19         gets(s3);
20         string s(s1),ss(s2),sss(s3);
21         string result;
22         for(int i=0;i<sss.size();i++){
23             string str;
24             for(int j=0;j<s.size();j++)if(i+j<sss.size()){
25                 if(sss[i+j]>='A'&&sss[i+j]<='Z'){
26                     str+=sss[i+j]-'A'+'a';
27                 }else 
28                     str+=sss[i+j];
29             }
30             if(str==s){i+=s.size()-1;result+=ss;}
31             else result+=sss[i];
32         }
33         cout<<result<<endl;
34     }
35     return 0;
36 }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值