Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪位大牛能帮菜鸟看一下那儿错了吗?不胜感激!!c语言的。。。是我理解错题意了还是???? #include<stdio.h> #define N 30000 void main() { int n,i,j; char s[N+10]; scanf("%d",&n); for(i=0;i<n;) if((s[i]=getchar())!='\n') i++; i=0; j=n-1; if(i==j) printf("%c\n",s[i]); else { for(;i<j;) { if(s[i]<s[j]) printf("%c",s[i++]); else if(s[i]>s[j]) printf("%c",s[j--]); else { if(s[i]<s[i+1]&&s[i]<s[j-1]) printf("%c%c",s[i++],s[j--]); else if(s[i+1]<=s[j-1]) printf("%c",s[i++]); else printf("%c",s[j--]); } } if(i==j) printf("%c\n",s[i]); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator