QvQ


私信TA

用户名:927937414

访问量:27968

签 名:

还是好好学习吧

等  级
排  名 77
经  验 9386
参赛次数 9
文章发表 44
年  龄 19
在职情况 学生
学  校
专  业 软件工程

  自我简介:

还没学算法的弱鸡

解题思路:

注意事项:

参考代码:

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int HuiWen(char *s,int i,int j){
	int low=i,high=j;
	while(low!=high&&s[low]==s[high]){
			low++;
			high--;
	}
	if(low>=high)
		return 1;
	else
		return 0;
}
int main(){
	char str[10001];
	while(cin>>str){
		int Max=1;
		int k,Len=strlen(str);
		for(int i=0;i<Len;i++){	
			for(int j=i+1;j<Len;j++){
				if(HuiWen(str,i,j))
					Max=Max>j-i+1?Max:j-i+1;
			}
		}
		cout<<Max<<endl;
	}
	return 0;
}


 

0.0分

10 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

吊爆了
2022-12-29 15:50:20
66666666666666
2022-05-24 21:46:36
厉害
2021-05-28 17:02:45
看懂的同学帮忙说下思路撒,谢谢
2021-05-26 11:13:15
牛逼
2019-09-03 23:58:40
  • «
  • 1
  • »