ural 1297 康神无敌马拉车
来源:互联网 发布:人格训练软件 编辑:程序博客网 时间:2024/04/29 17:50
#include<stdio.h>#include<iostream>#include<string>#include<cstdio>#include<algorithm>#include<cmath>using namespace std;char qdu[100005];int qqq,www;void manachar(){ int i; int res = 0; for (i = 0;qdu[i];i++) { int l = i; int r = i; while (qdu[i] == qdu[r + 1])r++; i = r; while (qdu[l - 1] == qdu[r + 1]) { r++;l--; } if (res < r - l + 1) { res = r - l + 1; qqq = l; www = r; } }}int main(){ string q; while (cin >> q) { if (q.size() == 1) { cout << q; cout << endl; continue; } memset(qdu, 0, sizeof(qdu)); for (int a = 0;a < q.size();a++) { qdu[a + 1] = q[a]; } qdu[0] = '$'; manachar(); if (qqq - www == 0) { cout << qdu[1] << endl; continue; } for (int a = qqq;a <= www;a++)cout << qdu[a]; cout << endl; } return 0;}
0 0
- ural 1297 康神无敌马拉车
- 马拉车算法
- 马拉车算法
- hdu 3613马拉车
- [HiHoCoder]#1015 : 马拉车
- 马拉车算法
- 马拉车算法模板
- SPOJ STC02 Antisymmetry——马拉车啊马拉车
- HDU 3294 马拉车算法
- Manacher马拉车算法总结
- 最长回文 --马拉车算法
- 最长回文子串-----“马拉车”算法
- Manacher's Algorithm 马拉车算法
- 最长回文字串(马拉车算法)
- 最长回文字符串(马拉车算法)
- 马拉车算法(易理解版)
- hdu3294_Girls' research_Manacher(马拉车算法)
- 浅谈Manacher(马拉车)算法
- kmp, next 数组
- Java开发中的23种设计模式详解(转)
- Spark之Streaming
- Hadoop学习笔记(8)-简述分布式数据库Hbase原理
- 上网过程的剖析
- ural 1297 康神无敌马拉车
- 设计模式原则详解
- 贝叶斯分类器(一)
- STM32F4 常用头文件
- LeetCode[206] Reverse Linked List
- RSA加密 简单介绍
- Android开发中的SQLite事务处理,即beginTransaction()方法
- linux Nvidia驱动
- MATLAB三维散点图的绘制(scatter3、plot3)