Online Judge
http://acm.hdu.edu.cn/showproblem.php?pid=1073
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7662 Accepted Submission(s): 2850Given 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.
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.
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
Presentation Error Presentation Error Wrong Answer Presentation Error
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char a1[5100] = { 0 }, a2[5100] = { 0 };
char b1[5100] = { 0 }, b2[5100] = { 0 };
char rub[5100];
void input(char a[])
{
gets(rub);
while (strcmp(rub, "START") != 0)
gets(rub);
while (gets(rub))
{
if (strcmp(rub, "END") == 0)
break;
if (strlen(rub) != 0)
strcat(a, rub);
strcat(a, "\n");
}
}
void clear(char c[])
{
int len = 0, i = 0, j = 0, k = 0;
len = strlen(c);
for (i = 0;i < len - 1;i++)
{
if (c[i] == ' ' || c[i] == '\t' || c[i] == '\n')
{
for (j = i;j < len;j++)
c[j] = c[j + 1];
c[len--] = '0';
i--;
}
}
}
main()
{
int T = 0, i = 0;
scanf("%d", &T);
for (i = 0;i<T;i++)
{
input(a1);
input(a2);
if (strcmp(a1, a2) != 0)
{
clear(a1);
clear(a2);
if (strcmp(a1, a2) == 0)
printf("Presentation Error\n");
else printf("Wrong Answer\n");
memset(a1, 0, sizeof(a1));
memset(a2, 0, sizeof(a2));
}
else
printf("Accepted\n");
}
}
1万+



被折叠的 条评论
为什么被折叠?



