|
|
back to boardwrong answer??D K Posted by T.N.F.G 25 Nov 2008 10:17 #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { int i,j,len,count=0,m,n; char ch[2001]; scanf("%s",ch); len=strlen(ch); if(len%2==0) { m=i=len/2-1; n=j=len/2; } else { m=i=len/2; n=j=len/2; } for(m,n;m>=0;m--,n++) { if(ch[m]>ch[n]) { break; } if(ch[m]<ch[n]) { count=1; break; } } if(count) { ch[i]=ch[i]+1; } else { ch[i]=ch[i]; } for(;i>=0;i--,j++) { ch[j]=ch[i]; } ch[j]='\0'; printf("%s\n",ch); } |
|
|