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 ...
随机推荐
- WebDAV服务漏洞利用工具DAVTest
WebDAV服务漏洞利用工具DAVTest WebDAV是基于Web服务的扩展服务.它允许用户像操作本地文件一样,操作服务器上的文件.借助该功能,用户很方便的在网络上存储自己的文件.为了方便用户使 ...
- hdu 1011(Starship Troopers,树形dp)
Starship Troopers Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- WebService数据示例
通过webservice提交xml数据以及soap协议的使用 上次已经给大家分享了简单的webservice的使用,提交给服务器的数据只是简单类型的数据,这次呢换成了xml,并通过一个小例子来讲解so ...
- WQS二分题集
WQS二分,一种优化一类特殊DP的方法. 很多最优化问题都是形如“一堆物品,取与不取之间有限制.现在规定只取k个,最大/小化总收益”. 这类问题最自然的想法是:设f[i][j]表示前i个取j个的最大收 ...
- SD 一轮集训 day4 圣城鼠
非常强的构造题. 很显然的是我们要构造一个类似菊花图的东西,因为这样的话两点之间路径的点数会非常少,很容易满足第二个条件. 但是因为直接菊花图的话会不满足第一个条件,,,所以我们可以构造一个类菊花图. ...
- 【线段树】Mayor's posters
[poj2528]Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 66154 Accept ...
- BZOJ 1131 [POI2008]Sta(树形DP)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1131 [题目大意] 给出一个N个点的树,找出一个点来,以这个点为根的树时,所有点的深度 ...
- [NOIp2017提高组]逛公园
题目大意: 给你一个有向图,若用dis(u,v)表示从u到v的最短路长度,求从1到n的长度不超过dis(1,n)+k的路径数. 思路: 首先分别预处理出以1,n为起点的单.源最短路. 对于合法的边重构 ...
- 修改request的parameter的几种方式(转载)
转载地址:https://blog.csdn.net/xieyuooo/article/details/8447301
- iOS中深拷贝、浅拷贝和retain的区别
浅拷贝:浅拷贝是对object对象的指针拷贝,让指针指向同一块内存地址,“对象永远只有一个",浅拷贝使对象的引用计数器+1.代码如下: 可以看出不可变字符串的指针指向了同一地址,并没有重新开 ...