BUCTOJ_ACM2017C 回文串的热爱
#include "iostream"
#include "algorithm"
#include "cstdio"
#include "cstring"
using namespace std; int main()
{
string s;
int n;
cin >> n;
while(n--)
{
cin >> s;
int len;
int flag = ;
len = s.length();
for(int i=;i < len/;i++)
{
if(s[i] != s[len-i-])
flag++;
}
if(flag == && len% == )
cout << "YES"<<endl;
else if(flag == )
cout << "YES"<< endl;
else
cout << "NO"<<endl;
}
return ;
}
1.计算字符串的长度 s.length()
BUCTOJ_ACM2017C 回文串的热爱的更多相关文章
- 【NOIP模拟赛】【乱搞AC】【奇技淫巧】【乘法原理】回文串计数
回文串计数 (calc.pas/calc.c/calc.cpp) [题目描述] 虽然是一名理科生,Mcx常常声称自己是一名真正的文科生.不知为何,他对于背诵总有一种莫名的热爱,这也促使他走向了以记忆量 ...
- P1872 回文串计数(回文树)
题目描述 小a虽然是一名理科生,但他常常称自己是一名真正的文科生.不知为何,他对于背诵总有一种莫名其妙的热爱,这也促使他走向了以记忆量大而闻名的生物竞赛.然而,他很快发现这并不能满足他热爱背诵的心,但 ...
- [LeetCode] Longest Palindrome 最长回文串
Given a string which consists of lowercase or uppercase letters, find the length of the longest pali ...
- [LeetCode] Shortest Palindrome 最短回文串
Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. ...
- [LeetCode] Palindrome Partitioning II 拆分回文串之二
Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...
- [LeetCode] Palindrome Partitioning 拆分回文串
Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...
- [LeetCode] Longest Palindromic Substring 最长回文串
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...
- bzoj 3676 回文串 manachar+hash
考虑每个回文串,它一定是它中心字母的最长回文串两侧去掉同样数量的字符后的一个子串. 所以我们可以用manachar求出每一位的回文半径,放到哈希表里并标记出它的下一个子串. 最后拓扑排序递推就行了.. ...
- BZOJ 3676: [Apio2014]回文串
3676: [Apio2014]回文串 Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 2013 Solved: 863[Submit][Status ...
随机推荐
- C/C++之类型强制转化
强制转化四种类型可能很多人都常常忽略就象我一样,但是有时还是比较有用的.不了解的建议看看,一些机制我也不是十分了解,只是将一些用法写出来让大家看看. ...
- CentOS7安装redis5.0
下载好redis5.0后解压在/tmp目录 cd /tmp/redis-/ make make过程中可能出现make[1]: *** [adlist.o] 错误 127,这是因为CentOS7默认没有 ...
- adb shell 命令详解,android, adb logcat
http://www.miui.com/article-275-1.html http://noobjava.iteye.com/blog/1914348 adb shell 命令详解,android ...
- C_Learning(3)
/ 结构体 / 声明结构体类型的一般形式: struct 结构体名[--表示的是这个结构体的类型] { 成员列表 }; [不要漏掉这个";"] / 声明结构可以放在main函 ...
- ubuntu服务器 安装 seafile 个人网盘
目录 ubuntu服务器 安装 seafile 个人网盘 一.实验环境: 二.实验流程介绍 三.网盘搭建 1.安装依赖环境 2.安装seafile 三.配置QQ域名邮箱 四.配置seafile邮件服务 ...
- Codeforces 788A Functions again - 贪心
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian super ...
- MIME协议(详解范例)
转载一:http://blog.csdn.net/bripengandre/article/details/2192982 转载二:http://blog.csdn.net/flfna/article ...
- python常见模块属性与方法
sys模块的变量 变量 描述 sys.path 模块搜索路径 path[0] 是当前脚本程序的路径名,否则为 '' sys.modules 已加载模块的字典 sys.version 版本信息字符串 s ...
- 理解 python 中__name__ = '__main__' 的作用
很多新手刚开始学习python的时候经常会看到python 中__name__ = \'__main__\' 这样的代码,可能很多新手一开始学习的时候都比较疑惑,python 中__name__ = ...
- Git 基础 —— 安装 配置 别名 对象
Git 基础学习系列 Git 基础 -- 安装 配置 别名 对象 Git 基础 -- 常用命令 Git 基础 -- 常见使用场景 Git基础 -- Github 的使用 Git 安装 Git下载地址 ...