HDU 1073 Online Judge(水~)

562 篇文章 1 订阅

Description
给出两个字符串,如果两个字符串完全相同则输出Accepted,如果两个字符串只相差’ ‘,’/t’或’\n’则输出Presentation Error,否则输出Wrong Answer
Input
第一行一整数T表示用例组数,每组用例输入两个字符串,每个字符串输入前先输入START,输入END表示输入结束
Output
如果两个字符串完全相同则输出Accepted,如果两个字符串只相差’ ‘,’/t’或’\n’则输出Presentation Error,否则输出Wrong Answer
Sample Input
这里写图片描述
Sample Output
Presentation Error
Presentation Error
Wrong Answer
Presentation Error
Solution
设两个串为a和b,先把两个串中的’ ‘,’/t’和’\n’都去掉得到两个字符串aa和bb,如果a和b相同则Accepted,如果aa和bb相同则Presentation Error,否则Wrong Answer
Code

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define maxn 5555
char t[maxn],a[maxn],aa[maxn],b[maxn],bb[maxn];
void deal(char *a,char *aa)
{
    gets(t);
    while(strcmp(t,"START")!=0)gets(t);
    while(gets(t))
    {
        if(strcmp(t,"END")==0)break;
        if(strlen(t))strcat(a,t);
        else strcat(a,"\n");
    }
    int res=0,len=strlen(a);
    for(int i=0;i<len;i++)
        if(a[i]!=' '&&a[i]!='\t'&&a[i]!='\n')aa[res++]=a[i];
    aa[res]='\0';
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        a[0]='\0',b[0]='\0';
        deal(a,aa),deal(b,bb);
        if(strcmp(a,b)==0)printf("Accepted\n");
        else if(strcmp(aa,bb)==0)printf("Presentation Error\n");
        else printf("Wrong Answer\n");
    }
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值