因为少考虑一种情况,wa了几次。。。
要注意: 输入的字符串要从非空格开始。。。即要经过fun()函数处理
#include<stdio.h>
#include<string.h>
char tmp[5000],s[5000],str[5000];
void input()
{
memset(s,0,sizeof(s));
memset(str,0,sizeof(str));
memset(tmp,0,sizeof(tmp));
gets(tmp);
while(strcmp(tmp,"START")!=0)
gets(tmp);
gets(s);
while(strcmp(gets(tmp),"END")!=0){
if(strlen(tmp)==0) strcat(s," ");
else strcat(s,tmp);
}
gets(tmp);
while(strcmp(tmp,"START")!=0)
gets(tmp);
gets(str);
while(strcmp(gets(tmp),"END")!=0){
if(strlen(tmp)==0) strcat(str," ");
else strcat(str,tmp);
}
}
void fun(char *temp)
{
int len=strlen(temp),i,j;
for(j=0,i=0;i<len;i++){
if(temp[i]!=' '&&(temp[i]!='\t'))
temp[j++]=temp[i];
}
temp[j]='\0';
}
int main()
{
int t,i,j,ls,lstr,flag;
while(scanf("%d",&t)!=EOF)
{
while(t--){
input();
if(strcmp(s,str)==0) printf("Accepted");
else{
fun(s); fun(str);
if(strcmp(s,str)==0) printf("Presentation Error");
else printf("Wrong Answer");
}
printf("\n");
}
}
return 0;
}