hdu 1073 Online Judgeという文字列で処理された水題は、午後中にwaがしました.のここ数日ちょっと変わったことが起こった.
Online Judge
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5735 Accepted Submission(s): 2157
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(''), 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
Sample Output
このようなテストデータのセットを主にします.
私は上記の状況を無視します.
ああ、コードはとても糞です.貼るのが恥ずかしい.
コード:
君と励まし合う
おととい、私の好きな女の子が一週間前に他の男に追いかけられたことを知りました.
おかしいことに、
私はまだとても落ち着いていて、このA題で色を変えないことができます.
自分が似合わないことを知っているかもしれません.彼女を邪魔したくない.
人间性はいつも利己的で、感じは他の人の过ごしたことがもっと良いことを望んで、しかしまた他の人の过ごしたことが自分で良いことを见ることができません.Bye
あなたの幸せを祈ります.
もしこれが間違ったことなら.
私のせいでしょう.
夢ですべてをごまかせば、自分へのごまかしだろう.
楽しんでほしい.
これはあなたの新しい始まりであり、私の新しい始まりでもあります.
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5735 Accepted Submission(s): 2157
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(''), 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
START
You are wrong!
END
START
You a
re wrong!
END
の答えはACです.私は上記の状況を無視します.
ああ、コードはとても糞です.貼るのが恥ずかしい.
コード:
#include <stdio.h>
#include <string.h>
char ques[5010] , ans[5010] ,temp[5010];
int main()
{
int t ;
scanf("%d",&t) ;
while(t--)
{
bool pe = false , wa = false ;
gets(temp) ;
while(strcmp(temp,"START")!=0)
{
gets(temp) ;
}
int len1 = 0 ;
gets(temp) ;
while(strcmp(temp,"END")!=0)
{
if(strlen(temp) == 0)
{
ques[len1++] = '
' ;
}
else
{
strncpy(ques+len1,temp,strlen(temp)) ;
len1 += strlen(temp) ;
ques[len1++] = '
' ;
}
gets(temp) ;
}
ques[len1] = '\0' ;
gets(temp) ;
while(strcmp(temp,"START")!=0)
{
gets(temp) ;
}
int len2 = 0 ;
gets(temp) ;
while(strcmp(temp,"END")!=0)
{
if(strlen(temp) == 0)
{
ans[len2++] = '
' ;
}
else
{
strncpy(ans+len2,temp,strlen(temp)) ;
len2 += strlen(temp) ;
ans[len2++] = '
' ;
}
gets(temp) ;
}
ans[len2] = '\0' ;
if(strcmp(ques,ans) == 0)
{
puts("Accepted") ;
}
else
{
int i = 0 , j = 0 ;
while(i<len1 && j<len2)
{
if(ques[i]!=ans[j])
{
if(ques[i] == ' ' || ques[i] == '\t' || ques[i] == '
')
{
while(ques[i] == ' ' || ques[i] == '\t' || ques[i] == '
')
{
++i ;
}
pe = true ;
}
if(ans[j] == ' ' || ans[j] == '\t' || ans[j] == '
')
{
while(ans[j] == ' ' || ans[j] == '\t' || ans[j] == '
')
{
++j ;
}
pe = true ;
}
if(ques[i]!=ans[j])
{
wa = true ;
break ;
}
}
++i,++j ;
}
if(i<len1)
{
while(ques[i] == ' ' || ques[i] == '\t' || ques[i] == '
')
{
i++ ;
}
if(i<len1)
{
wa = true ;
}
else
{
pe = true ;
}
}
if(j<len2)
{
while(ans[j] == ' ' || ans[j] == '\t' || ans[j] == '
')
{
j++ ;
}
if(j<len2)
{
wa = true ;
}
else
{
pe = true ;
}
}
if(wa)
{
puts("Wrong Answer") ;
}
else if(pe)
{
puts("Presentation Error") ;
}
else
{
puts("Accepted") ;
}
}
}
return 0 ;
}
君と励まし合う
おととい、私の好きな女の子が一週間前に他の男に追いかけられたことを知りました.
おかしいことに、
私はまだとても落ち着いていて、このA題で色を変えないことができます.
自分が似合わないことを知っているかもしれません.彼女を邪魔したくない.
人间性はいつも利己的で、感じは他の人の过ごしたことがもっと良いことを望んで、しかしまた他の人の过ごしたことが自分で良いことを见ることができません.Bye
あなたの幸せを祈ります.
もしこれが間違ったことなら.
私のせいでしょう.
夢ですべてをごまかせば、自分へのごまかしだろう.
楽しんでほしい.
これはあなたの新しい始まりであり、私の新しい始まりでもあります.