CF410div2 A. Mike and palindrome
/*
CF410div2 A. Mike and palindrome
http://codeforces.com/contest/798/problem/A
水题
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <map>
#include <set>
//#define test
using namespace std;
const int Nmax=1e6+;
char s[];
char tmp[];
int n;
int check()
{
for(int i=;i<n;i++)
if(s[i]!=s[n-i-])
return ;
return ;
}
int main()
{
#ifdef test
#endif
scanf("%s",tmp);
n=strlen(tmp);
int flag=;
for(int i=;i<n;i++)
s[i]=tmp[i];
if(n&)
{
if(check())
{
printf("YES\n");
return ;
}
}
for(int i=;i<n;i++)
{
for(int j=;j<n;j++)
s[j]=tmp[j];
if(s[i]==s[n-i-])
continue;
else
{
s[i]=s[n-i-];
if(check())
flag=;
}
}
if(flag)
printf("YES\n");
else
printf("NO\n");
return ;
}
CF410div2 A. Mike and palindrome的更多相关文章
- Codeforces 798A - Mike and palindrome
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Codeforces Round #410 (Div. 2) A. Mike and palindrome
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- CF410div2 B. Mike and strings
/* CF410div2 B. Mike and strings http://codeforces.com/contest/798/problem/B 字符串 暴力 题意:给你n个串,每次操作可以将 ...
- CF410div2 D. Mike and distribution
/* CF410div2 D. Mike and distribution http://codeforces.com/contest/798/problem/D 构造 题意:给出两个数列a,b,求选 ...
- Codeforces Round #410 (Div. 2) A. Mike and palindrome【判断能否只修改一个字符使其变成回文串】
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Mike and palindrome CodeForces - 798A
题目链接 一个简单的题目,但是却很少有人可以一次AC,比如我就瞎写wa了一次... 写本博算个教训录吧. 题目给出一个字符串,让你严格的改变一个字符使改变后的字符串是一个回文串. 回文串不用解释了.不 ...
- 【codeforces 798A】Mike and palindrome
[题目链接]:http://codeforces.com/contest/798/problem/A [题意] 让你严格改变一个字符,使得改变后的字符串为一个回文串; 让你输出可不可能; [题解] 直 ...
- Codeforces Round #410 (Div. 2)(A,字符串,水坑,B,暴力枚举,C,思维题,D,区间贪心)
A. Mike and palindrome time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...
- Codeforces Round #410 (Div. 2)A B C D 暴力 暴力 思路 姿势/随机
A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
随机推荐
- codevs1312连续自然数和
1312 连续自然数和 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 对于一个自然数M,求出所有的连续的自然数段 ...
- [Swift通天遁地]三、手势与图表-(4)3DTouch功能在项目中的应用
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- quill支持json吗
RT quill目前的驱动(2.4.2版本)不支持json,等待作者更新版本吧
- ACM_最短网络(最小生成树)
Problem Description: Farmer John has been elected mayor of his town! One of his campaign promises wa ...
- linux命令(006) -- w
w命令用于显示已经登陆系统的用户列表,并显示用户正在执行的指令.执行这个命令可得知目前登入系统的用户有那些人,以及他们正在执行的程序.单独执行w命令会显示所有的用户,您也可指定用户名称,仅显示某位用户 ...
- Linq学习(二)-本次学习用到的资料
本次学习用到的数据库初始化脚本如下 use KMS create table Blog_User ( UserId ,1), NickName ), CreateTime datetime ) cre ...
- swift单例创建的几种方法
//单例方法1 class SingleTonOne{ static var sharedInstanceOne:SingleTonOne{ struct SingleTonStruct { stat ...
- [ NOIP 1998 ] TG
\(\\\) \(\#A\) 车站 火车从第\(1\)站开出,上车的人数为\(a\),然后到达第\(2\)站,在第\(2\)站有人上.下车,但上.下车的人数相同,因此在第\(2\)站开出时(即在到达第 ...
- 实现div毛玻璃背景
毛玻璃效果 ios里毛玻璃效果的使用非常多,本文介绍一个实现div毛玻璃背景的方法 CSS3 Filter CSS3的Filter主要用在图像的特效处理上,默认值为none,还有以下备选项: 1. ...
- JS——for
打印两行星星: <script> for (var i = 0; i < 2; i++) { for (var j = 0; j < 10; j++) { document.w ...