标签:bsp nbsp break scanf blog turn amp print logs
1 //递归就是快。。。 2 #include<stdio.h> 3 char s[100]; 4 int lenth(char*); 5 int check(char*,int); 6 int main() 7 { 8 int n; 9 scanf("%d",&n); 10 while(n--) 11 { 12 scanf("%s",s); 13 int len=lenth(s); 14 printf("%d\n",check(s,len)); 15 } 16 } 17 18 int lenth(char s[]) 19 { 20 int i=0; 21 while(s[i]) 22 ++i; 23 return i; 24 } 25 26 int check(char s[],int x) 27 { 28 if(x%2) 29 return x; 30 int i; 31 for(i=0; i<x/2; ++i) 32 if(s[i]!=s[x-i-1]) 33 break; 34 if(i==x/2) 35 check(s,x/2); 36 else 37 return x; 38 }
标签:bsp nbsp break scanf blog turn amp print logs
原文地址:http://www.cnblogs.com/qq188380780/p/6360494.html