没有合适的资源?快使用搜索试试~ 我知道了~
int main() { char * example=new char[100]; cin >> example; cout<<GetLongestSymmetricalLength(example)<<endl; return 0; }
资源推荐
资源详情
资源评论
#include<iostream>
#include<cstdlib>
using namespace std;
/*
判断起始指针为pBegin,结束指针为pEnd的字符串是否对称
*/
bool IsSymmetrical(char* pBegin, char* pEnd)
{
if (pBegin == NULL || pEnd == NULL || pBegin > pEnd)
return false;
while (pBegin < pEnd)
{
if (*pBegin != *pEnd)
return false;
pBegin++;
pEnd--;
}
return true;
}
/*
取得所有对称子串的最大长度
复杂度:O(n^3)
*/
int GetLongestSymmetricalLength(char* pString)
{
if (pString == NULL)
return 0;
int symmeticalLength = 1;
#include<cstdlib>
using namespace std;
/*
判断起始指针为pBegin,结束指针为pEnd的字符串是否对称
*/
bool IsSymmetrical(char* pBegin, char* pEnd)
{
if (pBegin == NULL || pEnd == NULL || pBegin > pEnd)
return false;
while (pBegin < pEnd)
{
if (*pBegin != *pEnd)
return false;
pBegin++;
pEnd--;
}
return true;
}
/*
取得所有对称子串的最大长度
复杂度:O(n^3)
*/
int GetLongestSymmetricalLength(char* pString)
{
if (pString == NULL)
return 0;
int symmeticalLength = 1;
资源评论
embedclub_LYF
- 粉丝: 16
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功