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

看看正文和References之间有没有多输出少输出空行,最后结束也要有一个空行。段落之间只有一个空行。

Posted by ciciatc at 2006-03-17 15:31:17 on Problem 1706
In Reply To:为什么会PE呢 Posted by:cpp06_00548159 at 2006-03-17 15:05:56
> #include<string.h>
> #include<iostream.h>
> #include<stdlib.h>
> #include<memory.h>
> 
> void main()
> {
> 	char in[85],*p,*start,*mov;
> 	int num[1005],i=0,j,k,mark,n=0;
> 	memset(num,0,1005*sizeof(int));
> 	bool cpyref=false,cpynor=false,last=true;
> 	char ref[3015][85];
> 	char (*position[1005])[85];
> 	while(cin.getline(in,85))
> 	{
> 		if(*in=='\0')
> 		{
> 			if(cpynor)
> 				cout<<endl;
> 			cpyref=false;
> 			cpynor=false;
> 		}
> 		else if((*in=='['||cpyref)&&!cpynor)
> 		{
> 			last=false;
> 			strcpy(ref[i++],in);
> 			cpyref=true;
> 		}
> 		else if(*in!='\0')
> 		{
> 			last=true;
> 			cpynor=true;
> 			start=in;
> 			while((p=strchr(start,'['))!=NULL)
> 			{
> 				mark=atoi(p+1);
> 				for(k=0;k<n;k++)
> 					if(num[k]==mark)
> 					{
> 						mark=k+1;
> 						break;
> 					}
> 				if(k>=n)
> 				{
> 					num[n++]=mark;
> 					mark=n;
> 				}
> 				for(mov=start;mov<=p;mov++)
> 					cout<<*mov;
> 				cout<<mark<<']';
> 				start=strchr(p,']')+1;
> 			}
> 			cout<<start<<endl;
> 		}
> 	}
> 	if(last)
> 		cout<<endl;
> 	for(j=0;j<i;j++)
> 	{
> 		if(*ref[j]=='[')
> 		{
> 			mark=atoi(ref[j]+1);
> 			for(k=0;k<n;k++)
> 				if(mark==num[k])
> 					break;
> 			position[k]=ref+j;
> 		}
> 	}
> 	for(j=0;j<n;j++)
> 	{
> 		cout<<'['<<j+1<<strchr(*position[j],']')<<endl;
> 		while(**(++position[j])!='['&&position[j]<ref+i)
> 			cout<<*position[j]<<endl;
> 		if(j<n-1)
> 			cout<<endl;
> 	}
> }

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