做道题,并没有太多的技巧,关键在与对Accepted,presented error 和wa的判断,第一步如果两者完全一样,那么很定是AC了
,否则如果去掉多余换行,空格,制表后还有不同说明是数据 不同,就wa,如果相同就是pe了........



Online Judge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4121    Accepted Submission(s): 1550


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  

1 #include<stdio.h>
2 #include<string.h>
3 #define MAX 5000
4 char s1[MAX+2],s2[MAX+2],temp[MAX+2];
5 char rs1[MAX],rs2[MAX];
6 void input(char *s1)
7 {
8 int i=0;
9 bool flag=false;
10 memset(temp,'\0',sizeof temp);
11 while(gets(temp),strcmp(temp,"END"))
12 {
13 if(flag!=true&&strcmp(temp,"START")==0)
14 flag=true;
15 if(strcmp(temp,"START")!=0&&flag==true)
16 {
17 if(*temp=='\0')
18
19 *(s1+strlen(s1))='\n';
20 else
21
22 strcat(s1,temp);
23
24 }
25 }
26 }
27 void inst(char s[],char *rs)
28 {
29 int k=0;
30 for(int i=0;s[i]!='\0';i++)
31 {
32 if(s[i]!='\n'&&s[i]!='\t'&&s[i]!=' ')
33 {
34 *(rs+k++)=s[i];
35 }
36 }
37 }
38 int main()
39 {
40 int t;
41 scanf("%d",&t);
42 getchar();
43 while(t--)
44 {
45 memset(s1,'\0',sizeof s1);
46 memset(s2,'\0',sizeof s2);
47 memset(rs1,'\0',sizeof rs1);
48 memset(rs2,'\0',sizeof rs2);
49 input(s1);
50 input(s2);
51 if(strcmp(s1,s2)==0)
52 puts("Accepted");
53 else
54 {
55 inst(s1,rs1);
56 inst(s2,rs2);
57 if(strcmp(rs1,rs2)==0)
58 puts("Presentation Error");
59 else
60 puts("Wrong Answer");
61 }
62
63 }
64 return 0;
65
66 }




编程是一种快乐,享受代码带给我的乐趣!!!