链接:https://ac.nowcoder.com/acm/contest/908/G

题意:

A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. For example, ”a”、”aba”、“abba” are palindrome and “abc”、”aabb” are not.

Let’s define a new function f(s).

For some string s, f(s) is the length of the longest palindrome substring.

    Now you should decide for the given string s, whether f(s) is great than 1.
    The string s only contains lowercase letters.

思路:

找类似aa, aba这种的回文串就行了

代码:

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
int n, m, k, t; int main()
{
cin >> n;
string s;
cin >> s;
bool flag = false;
for (int i = 1;i < n-1;i++)
{
if (s[i] == s[i-1] || s[i-1] == s[i+1])
{
flag = true;
break;
}
}
if (s[n-1] == s[n-2])
flag = true;
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl; return 0;
}

  

最新文章

  1. python学习笔记七 初识socket(进阶篇)
  2. CSRF攻击原理以及防御
  3. FooTable高级的响应式表格jQuery插件
  4. arping 通知网关刷新IP
  5. 在 Node.js 上调用 WCF Web 服务
  6. JavaScript DOM 编程艺术(第2版)读书笔记 (8)
  7. asp mvc 路由
  8. lightoj 1291 无向图边双联通+缩点统计叶节点
  9. hdu 2853
  10. Unity属性的封装、继承、方法隐藏
  11. C++const使用(06)
  12. CodeForces 11D(状压DP 求图中环的个数)
  13. C++对象模型(五):The Semantics of Data Data语义学
  14. vue踩坑记
  15. 正则 ?&lt;= 和 ?= 用法,范例
  16. java 的访问权限控制
  17. POJ2387(dijkstra堆优化)
  18. 04. pt-deadlock-logger
  19. deferred对象详解
  20. 二:nodejs+express+redis+bootstrap table+jquery UI

热门文章

  1. python的tkinter对话框
  2. 一次php脚本出现段错误(Segment fault)的经历
  3. kvm初体验之七:attach usb storage device to a VM
  4. 分享知识-快乐自己:初识 Hibernate 概念片(一)
  5. Struts2与ServletAPI解耦
  6. 【HDU 6126】Give out candies 最小割
  7. OpenCV——花环生成函数
  8. create-react-app使用的问题
  9. BZOJ_2813_奇妙的Fibonacci_线性筛
  10. AndyQsmart ACM学习历程——ZOJ3872 Beauty of Array(递推)