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"> ...
随机推荐
- 使用zbar 解码二维码 条形码
#!/usr/bin/env python # coding: u8 import os import zbar import Image import urllib import uuid def ...
- html checkbox 实现全选/取消全选
html checkbox 实现全选/取消全选 <html> <body> <table border="1"> <tr> < ...
- 一个下载git库代码的脚本
由于每日构建需求, 须要用脚本下载代码, 实现自己主动化编译, 这个脚本是整个系统的一小块功能 #!/bin/bash #@author Liuyang #@date 2015-06-23 funct ...
- ftp mybatis
c# 字符串和Ascii码转换http://www.cnblogs.com/JoshuaDreaming/archive/2010/11/19/1882068.html ftp 公式 http://w ...
- <LeetCode OJ> 26 / 264 / 313 Ugly Number (I / II / III)
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers ...
- Atitit. Derby的使用总结attilax
Atitit. Derby的使用总结attilax 1. Derby数据库的存储结构1 2. Derby gui工具1 3. 代码读写derby2 4. 与sqlite db4o的对比4 5. 参考5 ...
- core image几个滤镜样例 oc版本号和swift版本号
oc版本号 //万花筒模式 + (CGImageRef) getKaleidoscope:(CIContext *)context { CIImage * image = [CIImage image ...
- 一个页面弄懂 CSS 样式选择器
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- iconv c 代码学习
(struct stringpool_t *)0)->stringpool_str15 含义为: 1.创建一个结构体stringpool_t 指针(struct stringpool_t *) ...
- linux挂载远程windows服务器上的ISO,给内网的服务器安装软件
原文: http://blog.csdn.net/chagaostu/article/details/45195817 给内网的服务器安装软件 直接用yum install XXX的话,会告知找不到源 ...