/*
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的更多相关文章

  1. Codeforces 798A - Mike and palindrome

    A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  2. 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 ...

  3. CF410div2 B. Mike and strings

    /* CF410div2 B. Mike and strings http://codeforces.com/contest/798/problem/B 字符串 暴力 题意:给你n个串,每次操作可以将 ...

  4. CF410div2 D. Mike and distribution

    /* CF410div2 D. Mike and distribution http://codeforces.com/contest/798/problem/D 构造 题意:给出两个数列a,b,求选 ...

  5. 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 ...

  6. Mike and palindrome CodeForces - 798A

    题目链接 一个简单的题目,但是却很少有人可以一次AC,比如我就瞎写wa了一次... 写本博算个教训录吧. 题目给出一个字符串,让你严格的改变一个字符使改变后的字符串是一个回文串. 回文串不用解释了.不 ...

  7. 【codeforces 798A】Mike and palindrome

    [题目链接]:http://codeforces.com/contest/798/problem/A [题意] 让你严格改变一个字符,使得改变后的字符串为一个回文串; 让你输出可不可能; [题解] 直 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. [python基础] python生成wordcloud并保存

    1.核心包 #jieba.pandas用来处理数据,数据源以xls格式存储的,这里用pandas进行处理import jieba from jieba import analyse import pa ...

  2. [算法基础]斐波那契(recursion+loop)两种方式执行时间对比

    一.斐波那契数列求第n项两种方式 1.递归(自上而下)def recur_fibonacci(n): if n <= 0: return 0 if n == 1: return 1 return ...

  3. nginx搭建基于http协议的视频点播服务器

    1,于由自己的服务器上已经安装好nginx(具体安装方法见我的另一篇文章,Linux中安装nginx),所以不再安装. 2,下载nginx_mod_h264_streaming-2.2.7.tar.g ...

  4. bzoj4299

    主席树+脑洞 首先我们有一个结论:如果我们已经凑出1-n,那么下一个数必须小于等于n+1才能凑出n+1,否则结束. 那么如果只有一次询问,我们把数组排序,然后扫一遍看每个数当前能不能加入.但是多组询问 ...

  5. String Successor(模拟)

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3490 题意:给出一个字符串,一个操作次数,每次操作从当前字符串最右边的字符 ...

  6. P2924 [USACO08DEC]大栅栏Largest Fence

    传送门 反正我是看不出来这题和凸包有什么关系--大佬们是怎么想到的-- 不准确一点的说,本题就是要我们求一个边上点数最多的凸包 我们可以先把所有的边都取出来,然后按极角排序.枚举这个凸包的起点,然后做 ...

  7. MFC学习篇(二):error LNK2005 及其解决方法

    环境:MFC条件下添加原有代码 >nafxcwd.lib(afxmem.obj) : error LNK2005: @YAPAXI@Z) already defined in LIBCMTD.l ...

  8. BZOJ DZY Loves Math系列

    ⑤(BZOJ 3560) $\Sigma_{i_1|a_1}\Sigma_{i_2|a_2}\Sigma_{i_3|a_3}\Sigma_{i_4|a_4}...\Sigma_{i_n|a_n}\ph ...

  9. Leetcode0457--Circular Array Loop

    [转载请注明]https://www.cnblogs.com/igoslly/p/9339478.html class Solution { public: bool circularArrayLoo ...

  10. windows下关闭进程树

    关闭进程需要特定权限,如果你程序权限不够也会导致关闭进程失败.关闭进程树,需要遍历给定进程下的所有子进程,这个过程可以用并查集来做. 1.编写获取进程父进程的代码 #define ProcessBas ...