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"> ...
随机推荐
- bootstrap popover 如何在hover状态移动到弹出上不消失
bootstrap中的popover其实就是对tooltip做了一定升级,拥有了标题和内容 概要 使用的时候依赖第三方插件 依赖tooltip插件 必须初始化 title 和 content 可以在p ...
- Django——静态文件配置
本文目的 最近用django开发项目,发现django的静态文件(js,css和img等)配置比较麻烦,开发环境和生产环境的配置还不一样,这里记录一下,作为备忘.我当前使用的版本是django v1. ...
- Altium Designer 10 | 常用库及部分元件名中英文对照表
———————————————————————————————————————————— 常用库及部分元件名中英文对照表 - - - - - - - - - - - - - - - - - - - - ...
- Visual studio C++ MFC的库函数末尾添加“A”和“W”的意义
背景 在使用Visual studio C++ MFC库函数ModifyMenu(...)函数,在Visual studio自动代码补全里提示没有ModifyMenu(...)这个函数,倒是有Modi ...
- Centos 7 安装 Mysql5.7(压缩包方式)
今天装的了mysql,遇到了很多问题,好在最后一一解决了,现在记录在此,防止日后老路重走... 1.下载 当然是去官网,下一个linux下的版本,64位的 tar.gz,好吧这里贴个名字——[mysq ...
- Spring 测试框架testContext代码举例
import javax.annotation.Resource; import org.junit.Test; import org.springframework.context.annotati ...
- html table表格导出excel的方法 html5 table导出Excel HTML用JS导出Excel的五种方法 html中table导出Excel 前端开发 将table内容导出到excel HTML table导出到Excel中的解决办法 js实现table导出Excel,保留table样式
先上代码 <script type="text/javascript" language="javascript"> var idTmr; ...
- Centos 删除用户
# 查看用户 tail /etc/passwd # 删除用户 userdel -rf ftpuser1
- Android WebView与JavaScript交互实现Web App
当我们去开发一个基于web的android app时,我们第一须要处理的就是与JavaScript的交互问题.Android须要做的事情就是开放某些特定的接口供web里的JavaScript调用,能够 ...
- atitit.atiLinq v2新特性attilax大总结 q326
atitit.atiLinq v2新特性attilax大总结 q326 1. V3规划 (分开sql2obj sql2sql sql2xml)1 2. V2新特性 Url linq的定义1 3. V1 ...