FZU 2122 又见LKity
直接模拟或者KMP
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
const double pi=acos(-);
const int maxn=;
char s1[maxn],s2[maxn],s[maxn],c[maxn];
int main() {
// freopen("in.txt","r",stdin);
while(gets(s1)) {
int len1=strlen(s1);
for(int i=; i<len1; i++) {
if(s1[i]>='A'&&s1[i]<='Z')
s1[i]+=;
}
gets(s2);
int len2=strlen(s2);
gets(s);
int len=strlen(s),flag,flag1,k=;
for(int i=; i<len; i++) {
flag1=;
if(s[i]==s1[]||s[i]==s1[]-) {
int ii=i+;
flag=,flag1=;
for(int j=; j<len1; j++,ii++) {
if(s[ii]!=s1[j]&&s[ii]!=s1[j]-) {
flag=;
break;
}
}
}
if(!flag&&!flag1) {
for(int j=; j<len2; j++) {
c[k++]=s2[j];
}
i+=len1-;
}
else {
c[k++]=s[i];
}
}
for(int i=; i<k; i++) {
printf("%c",c[i]);
}
printf("\n");
}
return ;
}
FZU 2122 又见LKity的更多相关文章
- FZU 2122 ——又见LKity——————【KMP字符串匹配】
Problem 2122 又见LKity Accept: 413 Submit: 1425Time Limit: 1000 mSec Memory Limit : 32768 KB Pr ...
- FZU 2122——又见LKity——————【字符串匹配、暴力】
Problem 2122 又见LKity Accept: 407 Submit: 1413Time Limit: 1000 mSec Memory Limit : 32768 KB Pr ...
- FZU 2122 又见LKity【字符串/正难则反/KMP/把一个字符串中某个部分替换为另一个部分】
嗨!大家好,在TempleRun中大家都认识我了吧.我是又笨又穷的猫猫LKity.很高兴这次又与各位FZU的ACMer见面了.最近见到FZU的各位ACMer都在刻苦地集训,整天在日光浴中闲得发慌的我压 ...
- FZU 2122 又见LKity(KMP+返回所有匹配位置)
基础kmp应用,找到所有匹配位置即可 #include<stdio.h> #include<string.h> #include<algorithm> #inclu ...
- hust训练赛20160330--B - 又见LKity
Problem 2122 又见LKity Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description 嗨!大家好,在Templ ...
- FZU2122_又见LKity
题目是说给你一个替换串和目标串.把一个长串中的所有的替换串替换为目标串而且不递归地替换. 很简单,直接做一次KMP然后直接替换. 注意替换后跳到替换串的尾部. 注意大小写的问题. #include & ...
- fzu 2122
#include<stdio.h> #include<string.h> #define N 51000 char s1[200],s2[200],s[N]; int main ...
- FZU 2202——犯罪嫌疑人——————【思维题】
犯罪嫌疑人 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status ...
- 纪中20日c组T2 2122. 【2016-12-31普及组模拟】幸运票
2122. 幸运票 (File IO): input:tickets.in output:tickets.out 时间限制: 1000 ms 空间限制: 262144 KB 具体限制 Goto P ...
随机推荐
- 大坑!常被忽视又不得不注意的小细节——%I64,%lld与cout(转载)
原地址:http://blog.csdn.net/thunders01/article/details/38879553 刚刚被坑完,OI一年了才知道%I64和%lld有区别(做题会不会太少),lon ...
- CoreBluetooth - 中心模式
BLE中心模式流程-coding BLE中心模式流程 - 1.建立中心角色 - 2.扫描外设(Discover Peripheral) - 3.连接外设(Connect Peripheral) - 4 ...
- Java 代码优化过程的实例介绍
衡量程序的标准 衡量一个程序是否优质,可以从多个角度进行分析.其中,最常见的衡量标准是程序的时间复杂度.空间复杂度,以及代码的可读性.可扩展性.针对程序的时间复杂度和空间复杂度,想要优化程序代码,需要 ...
- BZOJ 3997 [TJOI 2015 组合数学] 解题报告
这个题我脑洞了一个结论: 首先,我们定义满足以下条件的路径为“从右上到左下的路径”: 对于路径上任何不相同的两个点 $(x_1, y_1)$,$(x_2, y_2)$,都有: $x_1\neq x_2 ...
- Seay工具分享
百度网盘:http://pan.baidu.com/share/home?uk=4045637737&view=share#category/type=0
- lr11 BUG?Failed to send data by channels - post message failed.
问题描述 : http协议,场景运行一会之后,报错! erro信息: Failed to send data by channels - post message failed. 解决方法 :ht ...
- NGUI所见即所得之UIAtlasMaker , UIAtlas (2)
本文的重点就是要将NGUI把多张图片打成一个图集(Atlas)的原理和过程研究下,学习下Unity提供的api和NGUI写的功能以及设计思想. (原文链接) 其它链接:NGUI所见即所得之UIRoot ...
- VC 对话框背景颜色、控件颜色(三种方法)
系统环境:Windows 7软件环境:Visual C++ 2008 SP1本次目的:为对话框设置背景颜色.控件颜色 既然MFC对话框不好开发,那么现在我们来开始美化我们的对话框.为对话框设置背景颜色 ...
- YII AR查询方法
ActiveRecord类文档:http://www.yiiframework.com/doc/guide/1.1/en/database.ar 对于一个Model Post 有如下的4中查询方法,返 ...
- tomcat docBase 和 path
<Context docBase="zjzc-web-api" path="/api" reloadable="false"/> ...