1 solutions
-
0
C :
#include<stdio.h> char a[200]; int pan(int a,int b); int main() { scanf("%s",a); int x=0; for(;a[x]!='\0';x++); int ans=x; while(pan(0,x-1)) { ans/=2; x/=2; } printf("%d",ans); return 0; } int pan(int m,int n) { int mid=(m+n)/2; for(int i=m;i<=mid;i++) if(a[i]!=a[n-i]) return 0; return 1; }
Python :
def huiwen(b): if b==b[::-1]: return 1 else: return 0 str1=input() while(huiwen(str1)): b=len(str1) str1=str1[0:int(b//2)] print(len(str1))
- 1
Information
- ID
- 10731
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By