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 ...
随机推荐
- PCB MS SQL 标量函数(CLR) 实现DataTable转HTML的方法
一.准备需转为HMLT字符串的DataTable数据 在数据库中执行一段SQL返回的数据 需转换后的HTML的文本 <html ><head></head>< ...
- js模拟复制
现在浏览器种类也越来越多,诸如 IE.Firefox.Chrome.Safari等等,因此现在要实现一个js复制内容到剪贴板的小功能就不是一件那么容易的事了. 一.实现点击按钮,复制文本框中的的内 ...
- [Apple开发者帐户帮助]六、配置应用服务(6)创建电子钱包标识符和证书
电子钱包提供称为通行证的信息的数字表示- 例如优惠券,演出门票或登机牌 - 允许用户兑换真实世界的产品或服务.您可以通过多种方式使用电子钱包: 选项1:请求,分发和更新通行证 首先注册通行证类型标识符 ...
- ACM_Alien And Password
Alien And Password Time Limit: 2000/1000ms (Java/Others) Problem Description: Alien Fred wants to de ...
- 357 Count Numbers with Unique Digits 计算各个位数不同的数字个数
给定一个非负整数 n,计算各位数字都不同的数字 x 的个数,其中 0 ≤ x < 10n.示例:给定 n = 2,返回 91.(答案应该是除[11,22,33,44,55,66,77,88,99 ...
- 326 Power of Three 3的幂
给出一个整数,写一个函数来确定这个数是不是3的一个幂.后续挑战:你能不使用循环或者递归完成本题吗? 详见:https://leetcode.com/problems/power-of-three/de ...
- 定制UVM Messages(参考)
UVM的Messages机制有些时候很繁琐,很多时候希望能够在UVM messages的基础上做一些个人化的订制,这里给出来一个找到的例子作为参考. my_macros.sv: `define ...
- IIS中实现http自动转换到https
IIS中实现http自动转换到https修改以下文件:C:\WINDOWS\Help\iisHelp\common\403-4.htm 为以下内容<!DOCTYPE HTML PUBLIC &q ...
- VHDL_ADC之cic_diffcell
library IEEE; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library edclib; use edclib.pkg_ ...
- 011--c数组--排序--组成最大数
数组--排序--组成最大数 组成最大数 任意输入一个自然数,输出该自然数的各位数字组成的最大数.例如,输入 1593 ,则输出为 9531 . 输入: 自然数 n 输出: 各位数字组成的最大数 ...