HDU 1073 Online Judge(字符串)
Online Judge
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4977 Accepted Submission(s): 1889
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.
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.
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
Presentation Error
Presentation Error
Wrong Answer
Presentation Error
题意:代码在线评測。返回三种结果,ac,pe,wa。 非常水的字符串处理,1A。
#include <cstdlib>
#include <string>
#include <iostream>
#include <sstream>
#include <cctype> using namespace std; string src, dest, start, end;
char sa[5001], sb[5001]; void readContent(string &s){
s.clear();
string ts;
while (getline(cin, ts)){
if (ts != "END"){
s += ts;
s += "\n";
}
else{
break;
}
}
} void judge(const string &src, const string &dest, bool &af, bool &pf, bool &wf){
af = pf = wf = false;
if (src == dest){
af = true;
return;
}
pf = true; int pos = 0;
for (int i = 0; i < src.length(); ++i){
if (!isspace(src[i])){
sa[pos++] = src[i];
}
}
sa[pos] = 0; pos = 0;
for (int i = 0; i < dest.length(); ++i){
if (!isspace(dest[i])){
sb[pos++] = dest[i];
}
}
sb[pos] = 0; if (strcmp(sa, sb) != 0){
wf = true;
}
} int main(){
int t;
bool af, pf, wf; cin >> t; while (t--){
cin >> start;
readContent(src);
cin >> start;
readContent(dest);
judge(src, dest, af, pf, wf); if (af){
cout << "Accepted" << endl;
}
else if (wf){
cout << "Wrong Answer" << endl;
}
else{
cout << "Presentation Error" << endl;
}
}
return 0;
}
HDU 1073 Online Judge(字符串)的更多相关文章
- HDOJ/HDU 1073 Online Judge(字符串处理~)
Problem Description Ignatius is building an Online Judge, now he has worked out all the problems exc ...
- HDU 1073 Online Judge (字符串处理)
题目链接 Problem Description Ignatius is building an Online Judge, now he has worked out all the problem ...
- 解题报告:hdu 1073 Online Judge
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073 Problem Description Ignatius is building an Onli ...
- HDU 1073 - Online Judge
模拟评测机判断答案 先判断有没有不一样的 有的话再提取出 有效子列 看看有没有错的 #include <iostream> #include <cstdio> #include ...
- HDU ACM 1073 Online Judge ->字符串水题
分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...
- hdu 1073 字符串处理
题意:给一系列的输出和标准答案,比较二者是AC,PE或WA 字符串处理还是比较薄弱,目前没什么时间搞字符串专题,所以遇到一题就努力搞懂 #include<cstdio> #include& ...
- HDU 1073
http://acm.hdu.edu.cn/showproblem.php?pid=1073 模拟oj判题 随便搞,开始字符串读入的细节地方没处理好,wa了好久 #include <iostre ...
- HDU2112 HDU Today 最短路+字符串哈希
HDU Today Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- hdu 1062 Text Reverse 字符串
Text Reverse Time L ...
随机推荐
- response (响应对象)
一.response响应过程 在去发送一个请求时, 会找到tomcat引擎 引擎会找到对应的web应用,并且会创建request对象和response对象 找到应用后, 会执行应用的web.xml再去 ...
- [AGC019E]Shuffle and Swap
[AGC019E]Shuffle and Swap 题目大意: 给出两个长度为\(n(n\le10000)\)的\(01\)串\(A_{1\sim n}\)和\(B_{1\sim n}\).两个串均有 ...
- [BalkanOI2016]Cruise
题目大意: 平面直角坐标系内有n个点,每个点有一个点权. 你从原点p出发,走若干个点然后回到原点. 两个点之间只能笔直走,你的收获为你的路径围起来的区域内的所有店权和除以路径长度. 问最大收益. 思路 ...
- Erlang学习记录(二)——基本数据类型
Erlang可以说和我以前接触过的语言都大不相同,这个从它的类型定义就可以看出来...反正学起来觉得既不熟悉,也不亲切,我估计在用Erlang写应用的时候,整个编程思路都要变一下了.不过存在即是合理的 ...
- [转]spring4.x注解概述
1. 背景 注解可以减少代码的开发量,spring提供了丰富的注解功能,因项目中用到不少注解,因此下定决心,经spring4.x中涉及到的注解罗列出来,供查询使用. 2. spring注解图 ...
- 8VC Venture Cup 2016 - Elimination Round G. Raffles 线段树
G. Raffles 题目连接: http://www.codeforces.com/contest/626/problem/G Description Johnny is at a carnival ...
- 从connect到express02-中间件morgan
控制台输出请求日志 输出格式 默认格式: dev, combined, tiny等 自定义格式: morgan(':method :url :status :res[content-length] - ...
- 【POI】解析xls报错:java.util.zip.ZipException: error in opening zip file
今天使用POI解析XLS,报错如下: Servlet.service() for servlet [rest] in context with path [/cetBrand] threw excep ...
- google的开源项目总结
转自http://www.feng5166.com/blog/424.html google的开源项目值得我们一用的,这些项目很有意义,甚至可以直接用在我们自己的工作上!学习编程的的一个比较好的方式就 ...
- Eclipse启动时禁用不必要的验证。
window>preferences>general>editors>text editors>Annotations,右边的Annotation type里,点选err ...