hdu 1073 Online Judge
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5071    Accepted Submission(s): 1925


Problem Description
Ignatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from correct output file and user's result file, then the system compare the two files. If the two files are absolutly same, then the Judge System return "Accepted", else if the only differences between the two files are spaces(' '), tabs('\t'), or enters('\n'), the Judge System should return "Presentation Error", else the system will return "Wrong Answer".




Given the data of correct output file and the data of user's result file, your task is to determine which result the Judge System will return.




Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case has two parts, the data of correct output file and the data of the user's result file. Both of them are starts with a single line contains a string "START" and end with a single line contains a string "END", these two strings are not the data. In other words, the data is between the two strings. The data will at most 5000 characters.




 
Output
For each test cases, you should output the the result Judge System should return.




Sample Input
4
START
1 + 2 = 3
END
START
1+2=3
END
START
1 + 2 = 3
END
START
1 + 2 = 3


END
START
1 + 2 = 3
END
START
1 + 2 = 4
END
START
1 + 2 = 3
END
START
1 + 2 = 3
END
 


Sample Output
Presentation Error
Presentation Error
Wrong Answer
Presentation Error
 


/*题解:
     依然是靠写外部函数解决,多写函数使思路明晰。
     一个input()输入数据,一个cmp()比较去掉' ','\n','\t'之后的数据 
    */
 
#include<cstdio>
#include<cstring>
char str1[5050],str2[5050];  //注意题目中的数组长度 
int input(char a[5050],char b[5050]){
    while(gets(a)&&strcmp(a,"END")){
        if(strlen(a)==0)
        strcat(str1,"\n");
        else
        strcat(str1,a);
    }
    while(gets(b)&&strcmp(b,"END")){
        if(strlen(b)==0)
        strcat(str2,"\n");
        else
        strcat(str2,b);
    }
}
int cmp(char a[5050],char b[5050]){
    char s1[5050],s2[5050];
    int len1=strlen(a),len2=strlen(b),i,j;
    if(strcmp(a,b)==0) printf("Accepted\n");
    else{
        for(i=0,j=0; i<len1; i++)
        if(a[i]!=' '&&a[i]!='\t'&&a[i]!='\n')
        s1[j++]=a[i];
        s1[j]='\0';
        for(i=0,j=0; i<len2; i++)
        if(b[i]!=' '&&b[i]!='\t'&&b[i]!='\n')
        s2[j++]=b[i];
        s2[j]='\0';
        if(strcmp(s1,s2)==0)
        printf("Presentation Error\n");
        else
        printf("Wrong Answer\n");
    }
}


int main(){
    int n;
    char a[5050],b[5050];
    scanf("%d",&n);
    getchar();
    while(n--){
        memset(str1,0,sizeof(str1));
        memset(str2,0,sizeof(str2));//这里必须初始化 
      //  memset(a,0,sizeof(a));//这里可以不初始化 
       // memset(b,0,sizeof(b));
        input(a,b);
        cmp(str1,str2);
    }
    return 0;
}