| ||||||||||
| 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 | |||||||||
Re:为什么总是PE啊?帮忙看看。In Reply To:为什么总是PE啊?帮忙看看。 Posted by:ds0448330 at 2006-03-15 20:42:14 > #include<stdio.h>
> #include<iostream.h>
> #include<stdlib.h>
> #include<string.h>
> short index[10000];
> void main()
> {
> short count=0;
> char temp[81];
> short reindex[10000];
> char* refer[10000];//注释段指针
> char number[6];
> short length=0;
> while(gets(temp))
> {
> if(temp[0]=='\0')//段间隔空行
> continue;
> //新注释段
> if(temp[0]=='[')
> {
> for(short i=1;temp[i]!=']';i++)
> number[i-1]=temp[i];
> number[i-1]='\0';
> char *referpara=new char[243];
> refer[atoi(number)]=referpara;
> short len=strlen(temp);
> i++;
> for(short j=0;i<len;i++,j++)
> referpara[j]=temp[i];
> referpara[j]='\n';
> j++;
> referpara[j]='\0';
> while(gets(temp))
> {
> if(temp[0]=='\0')//段间隔空行
> break;
> strcat(referpara,temp);
> strcat(referpara,"\n");
> }
> continue;
> }
> //正文段
> do
> {
> if(temp[0]=='\0')//段间隔空行
> break;
> short len=strlen(temp);
> for(short i=0;i<len;i++)
> {
> if(temp[i]=='[')
> {
> i++;
> for(short j=0;temp[i]!=']';j++,i++)
> number[j]=temp[i];
> number[j]='\0';
> short num=atoi(number);
> if(index[num]==0)//还未注册的索引号
> {
> count++;
> index[num]=count;
> reindex[count]=num;
> }
> printf("[%d]",index[num]);
> }
> else
> printf("%c",temp[i]);
> }
> printf("\n");
> }while(gets(temp));
> printf("\n");
> }
> for(short i=1;i<=count;i++)
> printf("[%d]%s\n",i,refer[reindex[i]]);
> printf("\n");
> }
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator