hduoj1073--Online Judge

     做道题,并没有太多的技巧,关键在与对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 }

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏码匠的流水账

聊聊springboot session timeout参数设置

本文主要介绍下spring boot中对session timeout参数值的设置过程。

3.1K20
来自专栏JadePeng的技术博客

Netty断线重连

Netty断线重连 最近使用Netty开发一个中转服务,需要一直保持与Server端的连接,网络中断后需要可以自动重连,查询官网资料,实现方案很简单,核心思想是...

53050
来自专栏ml

HDUOJ----(1016)Prime Ring Problem

Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536...

370100
来自专栏ml

HDUOJ--2079选课时间(题目已修改,注意读题)

选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3...

37760
来自专栏服务端技术杂谈

dubbo源码学习笔记----registry

注册工厂 public interface RegistryFactory { Registry getRegistry(URL url); } ...

26840
来自专栏算法修养

PAT 甲级 1025 PAT Ranking

1025. PAT Ranking (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题...

334100
来自专栏编程坑太多

JAVA实现Excel导入导出

65730
来自专栏个人分享

Topology的构建

10720
来自专栏码匠的流水账

聊聊storm的messageTimeout

storm-2.0.0/storm-client/src/jvm/org/apache/storm/Config.java

28340
来自专栏菩提树下的杨过

silverlight:ListBox中如何取得DateTemplate/ItemsPanelTemplate中的命名控件?

Xaml如下: <UserControl x:Class="ToolsTest.Test"     xmlns="http://schemas.microsof...

20550

扫码关注云+社区

领取腾讯云代金券