题目描述
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".
输入
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.
输出
For each test cases, you should output the the result Judge System should return.
样例输入 START
+ =
END
START
+=
END
START
+ =
END
START
+ = END
START
+ =
END
START
+ =
END
START
+ =
END
START
+ =
END
样例输出
Presentation Error
Presentation Error
Wrong Answer
Presentation Error
题目链接:http://acm.zznu.edu.cn/problem.php?id=1163
*************************************************
题意:OJ的判题系统,只判 AC , WA ,PE。将所有的字符读入(包括回车)到一个字符串中,逐个比较,如果完全相同 AC , 如果只有space , '\t' 或者 '\n'处不同则 PE 否则 WA
分析:第二行空相当于一个'\0',所以我们要写个循环把每一行的值都存入相同一个串,再比较。
AC代码:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<limits.h>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <vector>
#include <queue>
#include <map> using namespace std; #define N 10000
#define INF 0x3f3f3f3f
#define met(a, b) memset (a, b, sizeof (a))//// met (dist, -1);
#define LL long long char a[N],b[N],s[],str[N],str1[N]; int main()
{
int T,i,j,len;
scanf("%d", &T);
getchar(); while(T--)
{
int k=,l=,f=; memset(a,'',sizeof(a));
memset(b,'',sizeof(b));
gets(s);
while(gets(str))
{
if(strcmp(str,"END")==)
break;
len=strlen(str);
for(i=;i<=len;i++)
a[k++]=str[i];
} gets(s);
while(gets(str1))
{
if(strcmp(str1,"END")==)
break; len=strlen(str1);
for(i=;i<=len;i++)
b[l++]=str1[i];
} for(i=,j=; i<=k&&j<=l;)
{
if(a[i] != b[j])
{
if(a[i] == ' '||a[i] == '\0'||a[i] == '\t')
{
i++;
f=;
}
else if(b[j]==' '||b[j]=='\0'||b[j]=='\t')
{
j++;
f=;
}
else
{
f=;
break;
}
}
else
{
i++;
j++;
}
} if(f==)
printf("Accepted\n");
else if(f==)
printf("Presentation Error\n");
else if(f==)
printf("Wrong Answer\n"); }
return ;
}