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 yuanyirui at 2007-06-03 01:05:05 on Problem 1917
#include <stdio.h>
#include <string.h>
int main()
{
  //  freopen("in.txt","r",stdin);
  //  freopen("out.txt","w",stdout);
    char s1[101],s2[101],s3[101],s4[101],line[105],*ch;
    int i,j,k,len,s1n,s2n,s3n,s4n,n;
    scanf("%d",&n); gets(line);
    while(n--){
        gets(line);
        len=strlen(line);
        k=j=0;
        s1n=s2n=s3n=s4n=0;
        for(i=0;i<len;i++){
            if(line[i]=='<' || line[i]=='>'){k++;continue;}
            if(k==1) s1[s1n++]=line[i];
            if(k==2) s2[s2n++]=line[i];
            if(k==3) s3[s3n++]=line[i];
            if(k==4) s4[s4n++]=line[i];
            printf("%c",line[i]);
        }
        printf("\n");
        gets(line);
        len=strlen(line);
        for(i=0;i<len;i++) if(line[i]=='.' && line[i+1]=='.' && line[i+2]=='.') break;
        for(j=0;j<i;j++) printf("%c",line[j]);
        for(j=0;j<s3n;j++) printf("%c",s3[j]);
        for(j=0;j<s2n;j++) printf("%c",s2[j]);
        for(j=0;j<s1n;j++) printf("%c",s1[j]);
        for(j=0;j<s4n;j++) printf("%c",s4[j]);
        for(i+=3;i<len;i++) printf("%c",line[i]);
        printf("\n");
        
    }
    return 1;
}

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