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 ...
随机推荐
- SRAM and DRAM
DRAM:(Dynamic Random Access Memory)动态随机访问存储器,只能将数据保存较短的时间.每隔一段时间需要对数据进行刷新一次,没有刷新的单元数据会丢失.常见的用途是作为内存( ...
- websocket的原理
首先明确几点: 1. websocket是一种协议.是html5的一种新协议: 2. 与http的区别是,它是一种双向通信协议,服务器和客户端都能主动向对方发送或接受数据: 3. websocket需 ...
- MySQL简明教程---级联约束
- ios TextField 不被键盘遮住
首先放一个scrollView窗口,将Scroll View视图占整个屏幕. 向Scroll View 添加TextField 控件. 首先,ViewController.h 代码如下; #i ...
- 【Leetcode 166】 Fraction to Recurring Decimal
Description: Given two integers representing the numerator and denominator of a fraction, return the ...
- 设置靠近 水平居中的主体内容Div 的 左侧位置固定的Div
示例效果: 1.主体内容的divMain 水平居中: 2.divLeft 靠近divMain ,位置固定,不随垂直滚动条而动: 相关代码: <html> <head runat=&q ...
- .net Jquery动态显示当前时间
<span id="Timer"></span> <script type="text/javascript"> $(fun ...
- jQuery——尺寸位置
获取宽:$(".box").width() 设置宽:$(".box").width(200) 获取高:$(".box").height() ...
- CSS——background综合运用
搜索栏图标: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...
- js 性能调试
今天有幸偶遇我早就神往已久的性能调试问题. 原来js调试工具里面有可以记录每个方法的执行时间的功能,站在此功能的肩膀上就可以对自己的程序性能.瓶颈了如指掌,就可以针对性的,瞄准目标,斩草除根,以绝后患 ...