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 |
实在想不到哪里错了啊?#include"stdio.h" #include"string.h" char str1[2005]; char str2[2005]; int main() { int N; scanf("%d\n",&N); memset(str1,0,sizeof(str1)); memset(str2,0,sizeof(str2)); int i,j; char temp; for(i=0;i<N-1;i++) { scanf("%s",&temp); str1[i]=temp; } i=0;j=N-1; int count; count=0; while(i<=j) { if(str1[i]>str1[j]) {str2[count]=str1[j];count++;j--; continue;} if(str1[i]<str1[j]) {str2[count]=str1[i];count++;i++; continue;} if(str1[i]==str1[j]&&str1[i+1]>str1[j-1]) {str2[count]=str1[j];count++;j--; continue;} else {str2[count]=str1[i];count++;i++; continue;} } int num=0; for(i=0;i<count;i++) { printf("%c",str2[i]); num++; if(num%80==0) {printf("\n");num=0;} } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator