Online Judge(字符串-格式)
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
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(字符串-格式)的更多相关文章
- vb.net字符串格式转为日期型
vb.net字符串格式转为日期型 比如 "20080815" 转换为"2008-05-15"Dim a As Date Dim s As String = ...
- string.Format出现异常"输入的字符串格式有误"的解决方法
string.Format出现异常"输入的字符串格式有误"的解决方法 今天在做项目时,碰到一个很奇怪的问题,我使用string.Format居然报“输入的字符串格式有误”的错误,我 ...
- javascript中字符串格式json如何转化成json对象
什么是JSON JSON(JavaScript Object Notation)是一种优美的JavaScript对象创建方法.JSON也是一种轻量级数据交换格式.JSON非常易于人阅读与编写,同时利于 ...
- Java将其他数据格式转换成json字符串格式
package com.wangbo.util; import java.beans.IntrospectionException; import java.beans.Introspector; i ...
- javascript中字符串格式转化成json对象记录
什么是JSON JSON(JavaScript Object Notation)是一种优美的JavaScript对象创建方法.JSON也是一种轻量级数据交换格式.JSON非常易于人阅读与编写,同时利于 ...
- 把json格式对象转成可提交字符串格式,会过滤掉函数 {a: {b: 3}, b: [1], c: "d"} -> a.b=3&b[0]=1&c=d
var json = { name: "任务名称" , scoreRule: "", score: "", // 如果规则表达式不为空,则默 ...
- EasyUI datagrid 分页Json字符串格式
//EasyUI datagrid 分页Json字符串格式 //{"total":xx,"rows":[{...},{...}]} total:总数 rows: ...
- string.Format字符串格式说明
先举几个简单的应用案例: 1.格式化货币(跟系统的环境有关,中文系统默认格式化人民币,英文系统格式化美元) string.Format("{0:C}",0.2) 结果为:¥0.20 ...
- 转换字符串格式,可用于sql in
/// <summary> /// 转换字符串格式,可用于sql in /// </summary> /// <param name="lst"> ...
随机推荐
- Unity3D教程宝典之Web服务器篇:(第二讲)从服务器下载图片
转载自风宇冲Unity3D教程学院 从Web服务器下载图片 上一讲风宇冲介绍了wamp服务器及安装.这回介绍如何从服务器下载内容至 ...
- 小伙子又乱码了吧-Java字符编码原理总结
前提 配合前面阅读的I/O和NIO的资料,现在总结一下关于字符集和乱码问题的原理和解决方案.参考资料: 码表ASCII Unicode GBK UTF-8 字符编码笔记ASCII,Unicode和UT ...
- SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这个 ...
- 【Python3 爬虫】08_正则表达式(元字符与语法)
元字符表 符号 说明 示例 . 表示任意字符 'abc' >>>'a.c' >>>结果为:'abc' ^ 表示字符开头 'abc' >>> ...
- linux小技巧(1)
1.避免文件夹拼写错误 shopt命令: 演示一下: 我想进入/home文件夹可是不小心拼写错了: [fulinux@ubuntu ~]$ cd /hoem-bash: cd: /hoem: No s ...
- C语言-十进制转换为二进制函数
char * itobs(int num, char * str) { int i; * sizeof(int); ; i >= ; i--, num >>= ) { str[i] ...
- 出现蓝屏代码0x0000007b的原因及解决办法
出现蓝屏代码0x0000007b的原因通常是硬盘的存储控制器驱动加载错误,我们可以通过对BIOS界面进行修复来解决这个问题.下面小编将详细介绍解决蓝屏代码0x0000007b的方法,一起来看看吧 导致 ...
- 【web开发学习笔记】Structs2 Result学习笔记(一)简介
Structs2 Result学习笔记(一)简介 问题一 <struts> <constant name="struts.devMode" value=" ...
- json.Decoder vs json.Unmarshal
128down voteaccepted It really depends on what your input is. If you look at the implementation of t ...
- c#中从string数组转换到int数组及比较两个字符串相等
string[] input = { "1", "2", "3", "4", "5", " ...