Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

实在想不到哪里错了啊?

Posted by ryangiggsy at 2008-07-28 21:47:25 on Problem 3617
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator