在线判题 (模拟)http://202.196.1.132/problem.php?id=1164

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#define N 200010

void input(char s[])
{
    char str[N] = {0};
    while(gets(str), strcmp(str, "START"));/****/
    while(gets(str), strcmp(str, "END"))/****/
    {
        if(str[0] == 0)
            strcat(s, "\n");
        else
            strcat(s, str);
    }
}//读入

void del(char s[])
{
    int i, j = 0;
    char s1[N] = {0};
    for(i = 0 ; s[i] != '\0' ; i++)
    {
        if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n')
            s1[j++] = s[i];
    }
    s1[j + 1] = '\n';
    strcpy(s, s1);
}//删除空格,制表符,回车

int judge(char a[], char b[])
{
    if(strcmp(a, b) == 0)
        return 1;
    del(a);
    del(b);
    if(strcmp(a, b) == 0)
        return 2;
    return 0;
}//判断
int main()
{
    int n, i, m;
    char s1[N], s2[N];
    scanf("%d", &n);
    for(i = 0 ; i < n ; i++)
    {
        memset(s1, 0, sizeof(s1));
        memset(s2, 0, sizeof(s2));
        input(s1);
        input(s2);
        m = judge(s1, s2);
        if(m == 1)
            printf("Accepted\n");
        else if(m == 2)
            printf("Presentation Error\n");
        else
            printf("Wrong Answer\n");
    }
    return 0;
}

 

posted @ 2015-06-09 19:26  午夜阳光~  阅读(391)  评论(0编辑  收藏  举报