Super-palindrome 【可能是暴力】

这道题目要求在最少的步数内将给定的字符串转化为超级回文串,即所有奇数长度的子串都是回文。可以通过全排列检查每个可能的两个字符组合,或判断是否为单一字符的回文串来解决。对于第二个测试用例'aaaaba',只需一步即可将其变为'aaaaaa'。
摘要由CSDN通过智能技术生成

 Super-palindrome

时间限制: 1 Sec  内存限制: 128 MB
提交: 486  解决: 166
[提交] [状态] [命题人:admin]

题目描述

You are given a string that is consisted of lowercase English alphabet. You are supposed to change it into a super-palindrome string in minimum steps. You can change one character in string to another letter per step.
A string is called a super-palindrome string if all its substrings with an odd length are palindrome strings. That is, for a string s, if its substring si...j satisfies j - i + 1 is odd then si+k = sj-k for k = 0,1,...,j-i+1.

 

输入

The fi rst line contains an integer T (1≤T≤100) representing the number of test cases.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值