题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073
数据判断,主要是如何判断WA和PE,吸收字符!
代码:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <ctype.h>
#include <iomanip>
#include <queue>
#include <stdlib.h>
using namespace std; char tmp[]; void shuru(char p[])
{
getchar();
gets(tmp);
while(gets(tmp))
{
if(strcmp(tmp,"END")==) break;
if(strlen(tmp)!=) strcat(p,tmp);
strcat(p,"\n");
}
} void duibi(char a[]){
int k=;
for(int i=;a[i];i++){
if(a[i]==' '||a[i]=='\t'||a[i]=='\n')
continue;
else
a[k++]=a[i];
}
a[k]='\0';
} int main()
{
int n;
char a[];
char b[];
while(~scanf("%d",&n)){
while(n--){
a[]='\0';
b[]='\0';
shuru(a);
shuru(b);;
if(strcmp(a,b)==){
cout<<"Accepted"<<endl;
continue;
}
else{
duibi(a);
duibi(b);
if(strcmp(a,b)==){
puts("Presentation Error");
continue;
}
}
puts("Wrong Answer");
}
}
return ;
}