Online Judge

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('\n'), 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

// 挺好的题,想了一阵,没想到好的方法,看了kuangbin大神的思路,很强, 把'\n'当字符加进去,再把实际数据分理出来,比较,是个很好的方法

还是太菜啊,继续刷题!!!

 #include <bits/stdc++.h>
using namespace std;
#define MX 5005 char s1[MX],s2[MX];
char data1[MX],data2[MX];
char tmp[MX]; void input(char *a,char *b)
{
gets(tmp);
while (gets(tmp))
{
if (strcmp(tmp,"END")==) break;
strcat(a,tmp);
strcat(a,"\n");
}
int t=;
int len = strlen(a);
for (int i=;i<len;i++)
{
if (a[i]!=' '&&a[i]!='\t'&&a[i]!='\n')
b[t++]=a[i];
}
b[t++]='\0';
} int main()
{
int T;
cin>>T;
getchar();
while (T--)
{
s1[]='\0';
s2[]='\0';
input(s1,data1);
input(s2,data2);
if (strcmp(s1,s2)==)
printf("Accepted\n");
else if (strcmp(data1,data2)==)
printf("Presentation Error\n");
else
printf("Wrong Answer\n");
}
return ;
}

Online Judge(字符串-格式)的更多相关文章

  1. vb.net字符串格式转为日期型

    vb.net字符串格式转为日期型  比如 "20080815" 转换为"2008-05-15"Dim a As Date  Dim s As String = ...

  2. string.Format出现异常"输入的字符串格式有误"的解决方法

    string.Format出现异常"输入的字符串格式有误"的解决方法 今天在做项目时,碰到一个很奇怪的问题,我使用string.Format居然报“输入的字符串格式有误”的错误,我 ...

  3. javascript中字符串格式json如何转化成json对象

    什么是JSON JSON(JavaScript Object Notation)是一种优美的JavaScript对象创建方法.JSON也是一种轻量级数据交换格式.JSON非常易于人阅读与编写,同时利于 ...

  4. Java将其他数据格式转换成json字符串格式

    package com.wangbo.util; import java.beans.IntrospectionException; import java.beans.Introspector; i ...

  5. javascript中字符串格式转化成json对象记录

    什么是JSON JSON(JavaScript Object Notation)是一种优美的JavaScript对象创建方法.JSON也是一种轻量级数据交换格式.JSON非常易于人阅读与编写,同时利于 ...

  6. 把json格式对象转成可提交字符串格式,会过滤掉函数 {a: {b: 3}, b: [1], c: "d"} -> a.b=3&b[0]=1&c=d

    var json = { name: "任务名称" , scoreRule: "", score: "", // 如果规则表达式不为空,则默 ...

  7. EasyUI datagrid 分页Json字符串格式

    //EasyUI datagrid 分页Json字符串格式 //{"total":xx,"rows":[{...},{...}]} total:总数 rows: ...

  8. string.Format字符串格式说明

    先举几个简单的应用案例: 1.格式化货币(跟系统的环境有关,中文系统默认格式化人民币,英文系统格式化美元) string.Format("{0:C}",0.2) 结果为:¥0.20 ...

  9. 转换字符串格式,可用于sql in

    /// <summary> /// 转换字符串格式,可用于sql in /// </summary> /// <param name="lst"> ...

随机推荐

  1. Python学习笔记(五)多进程实现并发服务器

      每创建一个TCP连接,就创建一个进程. 代码如下: # coding: utf-8 import socket import os import sys import signal import ...

  2. re中match和search的不同

    re.match与re.search的区别:re.match只匹配字符串的开始,如果字符串开始不符合正则表达式,则匹配失败,函数返回None:而re.search匹配整个字符串,直到找到一个匹配.

  3. Laravel 学习 .env文件 getenv 获得环境变量的值

    Laravel 学习 .env文件 getenv 获得环境变量的值  我们还需要对应用的 .env 文件进行设置,为应用指定数据库名称 sample. .env . . . DB_DATABASE=s ...

  4. import * as obj from 'xx'

    import * as obj from 'xx'  这种写法是把所有的输出包裹到obj对象里 例如: xx里中: export function hello(){ return '我是hello 内 ...

  5. LeetCode——Anagrams

    Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be ...

  6. shell脚本监控调度器/proc进程是否运行(嵌套循环)

    /proc/<pid>/schedstat $/schedstat First: , Second:time spent waiting on a runqueue,这个值与上面的se.w ...

  7. git merge rebase的区别及应用场景

    前两天和同事交流发现他在日常开发中跟上游保持同步每次都是用git pull操作,而我一直习惯git fetch然后rebase,发现这两种操作后的log是有些区别的.他每次pull操作之后都会自动生成 ...

  8. list操作总结. dict操作及文件操作

    1: 列表的操作 help(list) # 列表的帮助,列出所有列表的用法 type(name) # type判断数据类型是列表还是字典或者元组 isinstance("字符", ...

  9. TLS

    1. SSL简介 SSL(SecureSocket Layer)安全套接层,是网景公司提出的用于保证Server与client之间安全通信的一种协议,该协议位于TCP/IP协议与各应用层协议之间,即S ...

  10. 数据库性能优化之SQL语句优化1

    一.问题的提出 在 应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图的的编写等体会不出SQL语句各种写法的性能优劣,但是如果将应用系统提交实 际应用后,随着数据库中数据的增加, ...