前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hduoj1073--Online Judge

hduoj1073--Online Judge

作者头像
Gxjun
发布2018-03-21 11:35:56
1K0
发布2018-03-21 11:35:56
举报
文章被收录于专栏:mlml
代码语言:javascript
复制
     做道题,并没有太多的技巧,关键在与对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

代码语言:javascript
复制
 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 }
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-07-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Online Judge
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档