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 ...
随机推荐
- javascript操作html元素CSS属性
下面先记录一下JS控制CSS所使用的方法. 1.使用javascript更改某个css class的属性... <style type="text/css"> .ori ...
- aix5下安装python和cx_Oracle
之前写了一个 linux下安装python和cx_Oracle 这次其实差不多. 1.解压安装包: Python-2.5.4.tar.bz2 cx_Oracle-5.0.4.tar.gz 2.安装py ...
- lua中的时间函数
-- 获取当前的格林尼治时间print(os.time())-- 获取当前时间的字符串表示,形如:11/28/08 10:28:37print(os.date())-- 获取当前日期的字符串表示,形如 ...
- Oracle 分析函数之聚集函数(MAX、MIN、AVG和SUM)
MAX 查找组中表达式的最大值 MAX(COL ) OVER ( [ <partition_by_clause> ] < order_by_clause > )MIN 查找组中 ...
- noj [1479] How many (01背包||DP||DFS)
http://ac.nbutoj.com/Problem/view.xhtml?id=1479 [1479] How many 时间限制: 1000 ms 内存限制: 65535 K 问题描述 The ...
- SVN服务器使用(二)
上篇主要介绍的VisualSVN Server 安装,这篇主要介绍VisualSVN Server 的使用. 首先打开VisualSVN Server Manager,如图: 可以在窗口的右边看到版本 ...
- 关于 IIS 上的 Speech 设置
在之前的开发过程中,发现在 微软各个版本的Speech中(从sdk5.1 到 最新的 Speech PlatFarme V11),在本地可以生成音频文件,但是在IIS上却生成无法生成完整的文件. 调试 ...
- java.util.List
/* * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETA ...
- JNI|在子线程中获得JNIEnv|AttachCurrentThread
A JNI interface pointer (JNIEnv*) is passed as an argument for each native function mapped to a Java ...
- 上海CEC大收购(包括华大九天)
紫光收购展讯.锐迪科后,上海开始通过扶植CEC培育新势力,CEC已经收购上海澜起,即将收购amlogic.Ominivision,还在与marvell眉来眼去,此外华大九天已经移植上海,加上之前的上海 ...