题意:和H差不多,这个是找字符串中最长的镜像字串;

思路:一样的思路,标记下;

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
int main()
{
char s[];
char s1[]="WTYUIOAHXVM";
int flag[];
int ans;
int t;
int len;
int len1;
int sum,sum1;
int maxx;
int left,right;
cin>>t;
while(t--)
{
cin>>s;
len=strlen(s);
len1=strlen(s1);
memset(flag,,sizeof(flag));
for(int i=;i<len;i++)
{
for(int j=;j<len1;j++)
if(s[i]==s1[j])
{
flag[i]=;break;
}
}
ans=;
for(int i=;i<=len-;i++)
{
if(flag[i])
{
left=i-;right=i+;sum=;
while(left>=&&right<len)
{
if(s[left]==s[right]&&flag[left]&&flag[right])
{
sum+=;
left--;
right++;
}
else
break;
}
left=i;right=i+;sum1=;
while(left>=&&right<len)
{
if(s[left]==s[right]&&flag[left]&&flag[right])
{
sum1+=;
left--;
right++;
}
else
break; } maxx=max(sum,sum1);
ans=max(ans,maxx);
}
else
continue;
}
cout<<ans<<endl;
}
return ;
}

gym-10135I的更多相关文章

  1. ACM: Gym 101047M Removing coins in Kem Kadrãn - 暴力

     Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Fo ...

  2. ACM: Gym 101047K Training with Phuket's larvae - 思维题

     Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO F ...

  3. ACM: Gym 101047E Escape from Ayutthaya - BFS

    Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  4. ACM: Gym 101047B Renzo and the palindromic decoration - 手速题

     Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64 ...

  5. Gym 101102J---Divisible Numbers(反推技巧题)

    题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...

  6. Gym 100917J---Judgement(01背包+bitset)

    题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...

  7. Gym 100917J---dir -C(RMQ--ST)

    题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...

  8. Gym 101102D---Rectangles(单调栈)

    题目链接 http://codeforces.com/gym/101102/problem/D problem  description Given an R×C grid with each cel ...

  9. Gym 101102C---Bored Judge(区间最大值)

    题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...

  10. 2016"百度之星" - 初赛(Astar Round2A)Gym Class(拓扑排序)

    Gym Class  Accepts: 849  Submissions: 4247  Time Limit: 6000/1000 MS (Java/Others)  Memory Limit: 65 ...

随机推荐

  1. 一道很有意思的java线程题

    这几天看结城浩的<java多线程设计模式>,跟着做一些习题,有几道题目很有意思,记录下自己的体会. 首先是题目(在原书212页,书尾有解答): public class Main { pu ...

  2. object detection[content]

    近些年,随着DL的不断兴起,计算机视觉中的对象检测领域也随着CNN的广泛使用而大放异彩,其中Girshick等人的<R-CNN>是第一篇基于CNN进行对象检测的文献.本文欲通过自己的理解来 ...

  3. object detection[SSD]

    0. 背景 经过了rcnn,spp,fast rcnn, faster rcnn,yolo,这里又到了ssd模型. faster rcnn的贡献是将候选框区域提取的部分也集成到CNN中去,并且与对象的 ...

  4. A2D JS框架

    写了个微型JS框架 主要实现了:showDialog.noConflict.定位元素.event绑定功能 使用端的代码: <head> <title></title> ...

  5. NCC Meetup 2018 Shanghai 活动小结(含PPT与视频)

    NCC Meetup 2018 上海的活动于2018年6月30日在微软上海港汇办公室进行.原本计划30人规模的小型活动,结果收到了逾60人的报名,其中大部均来到现场参加了活动. 本次活动得到了微软公司 ...

  6. 波音,自动驾驶bug未修复,致346人丧生!5个月内两次坠毁!其中,包括8名中国公民

    一,波音737 MAX再次坠毁 继2018年10月29日,印尼波音737MAX飞机坠入爪哇海,导致178名乘客不幸遇难后,时隔不足5月,上周日,埃塞俄比亚航空公司一架波音737MAX客机在飞往肯尼亚途 ...

  7. Jenkins - 构建Allure Report

    前言 本文为Pytest+Allure定制报告进阶篇,集成Jenkins,在Jenkins中直接生成报告,更方便测试人员查看. 一.安装插件allure-jenkins-plugin 1.进入系统管理 ...

  8. javaMail发邮件,激活用户账号

    用javamail实现注册用户验证邮箱功能.用户注册后随机生成一个uuid作为用户的标识,传递给用户然后作为路径参数.发送html的内容到用户注册的邮箱里,若用户点击后去往的页面提交username和 ...

  9. Glad to see you! CodeForces - 810D (交互+二分)

    This is an interactive problem. In the output section below you will see the information about flush ...

  10. MongoDB之$

    MongoDB之$ $  保存符合索引条件的下标 db.userinfo.updateOne({ghobby: },{$set:{'ghobby.2': '四'}}) // 将userinfo表中的g ...