Codeforces 96C - Hockey
字符串处理
代码:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=;
const int INF=0x7f7f7f7f;
char s[N][N];
char res[N],ss;
int vis[N]={};
int main()
{
int n;
cin>>n;
for(int i=;i<n;i++)
{
getchar();
cin>>s[i];
}
getchar();
cin>>res;
getchar();
cin>>ss;
for(int j=;j<n;j++)
for(int i=;i<strlen(res);i++)
{
if(abs(s[j][]-res[i])=='a'-'A'||abs(s[j][]-res[i])==)
{
bool flag=true;
for(int k=;k<strlen(s[j]);k++)
if(abs(s[j][k]-res[i+k])!='a'-'A'&&abs(s[j][k]-res[i+k])!=)flag=false;
if(flag)
{
for(int k=;k<strlen(s[j]);k++)vis[i+k]=;
}
}
}
for(int i=;i<strlen(res);i++)
{
if(vis[i])
{
if(isupper(res[i])&&res[i]!=ss-'a'+'A')res[i]=ss-'a'+'A';
else if(islower(res[i])&&res[i]!=ss)res[i]=ss;
else if(isupper(res[i]))
{
for(int j=;j<;j++)
if(res[i]!='A'+j)
{
res[i]='A'+j;
break;
}
}
else
{
for(int j=;j<;j++)
if(res[i]!='a'+j)
{
res[i]='a'+j;
break;
}
}
}
}
cout<<res<<endl;
return ;
}
Codeforces 96C - Hockey的更多相关文章
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
- CodeForces - 148D Bag of mice
http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...
随机推荐
- 浏览器测试string是否为图片
在浏览器中直接打如下代码.其中adcd为图片转成的string data:image/jpeg;base64,abcd
- PKU2503_map应用
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...
- python学习第一次
一,安装python 官网下载地址:https://www.python.org/downloads/windows/ 我下载的是最新的: Download Windows x86 web-based ...
- ngxin开启rewrite伪静态
1.编辑nginx配置文件 vi /usr/local/nginx/conf/nginx.conf #include enable-php.conf; include enable-php-pathi ...
- Python: re.IGNORECASE 标志参数字符串忽略大小写的搜索替换
为了在文本操作时忽略大小写,需要在使用re 模块的时候给这些操作提供re.IGNORECASE 标志参数.比如 >>> text = 'UPPER PYTHON, lower pyt ...
- C++ 简明教程
C++是一种系统编程语言.用它的发明者, Bjarne Stroustrup的话来说,C++的设计目标是: 成为“更好的C语言” 支持数据的抽象与封装 支持面向对象编程 支持泛型编程 C++提供了对硬 ...
- tortoisegit 代码的回滚方式 --两种
TortoiseGit有两种回滚代码方式, 一种是导出指定版本代码为zip格式,不影响源代码:另一种是直接在源代码上回滚, 指定版本之后写的代码都会被删除.下面分别介绍这两种方法: 首先进入版本日志对 ...
- java android 环境变量配置备忘录
java android 环境变量配置备忘录,全新重装系统要用到,备忘下来; JAVA_HOME D:\Java\jdk1.6.0_07 CLASSPATH .;%JAVA_HOME%\lib\dt ...
- Python Web笔记之高性能网络编程
请参考博客: https://blog.csdn.net/russell_tao/article/details/9111769
- PHP多进程处理并行处理任务实例(转,备用)
本文目的本文通过例子讲解linux环境下,使用php进行并发任务处理,以及如何通过pipe用于进程间的数据同步.PHP多进程通过pcntl_XXX系列函数使用多进程功能.注意:pcntl_XXX只能运 ...