Online Judge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 4977    Accepted Submission(s): 1889

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
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
 
Sample Output
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(字符串)的更多相关文章

  1. HDOJ/HDU 1073 Online Judge(字符串处理~)

    Problem Description Ignatius is building an Online Judge, now he has worked out all the problems exc ...

  2. HDU 1073 Online Judge (字符串处理)

    题目链接 Problem Description Ignatius is building an Online Judge, now he has worked out all the problem ...

  3. 解题报告:hdu 1073 Online Judge

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073 Problem Description Ignatius is building an Onli ...

  4. HDU 1073 - Online Judge

    模拟评测机判断答案 先判断有没有不一样的 有的话再提取出 有效子列 看看有没有错的 #include <iostream> #include <cstdio> #include ...

  5. HDU ACM 1073 Online Judge -&gt;字符串水题

    分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...

  6. hdu 1073 字符串处理

    题意:给一系列的输出和标准答案,比较二者是AC,PE或WA 字符串处理还是比较薄弱,目前没什么时间搞字符串专题,所以遇到一题就努力搞懂 #include<cstdio> #include& ...

  7. HDU 1073

    http://acm.hdu.edu.cn/showproblem.php?pid=1073 模拟oj判题 随便搞,开始字符串读入的细节地方没处理好,wa了好久 #include <iostre ...

  8. HDU2112 HDU Today 最短路+字符串哈希

    HDU Today Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  9. hdu 1062 Text Reverse 字符串

    Text Reverse                                                                                  Time L ...

随机推荐

  1. RedisDesktopManager-0.9.3 for windows (转)

    redis数据库的可视化工具 官方出了RedisDesktopManager-0.9.8版本后要购买了.之前自用的Windows版本0.9.3.817有需要的可以使用.解压直接启动即可.主要以备自用! ...

  2. Codeforces Round #119 (Div. 2) Cut Ribbon(DP)

    Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  3. 计蒜客 UCloud 的安全秘钥(困难)(哈希)

    UCloud 的安全秘钥(困难) 编辑代码 9.53% 1200ms 262144K 每个 UCloud 用户会构造一个由数字序列组成的秘钥,用于对服务器进行各种操作.作为一家安全可信的云计算平台,秘 ...

  4. Windows下安装Memcached服务及安装PHP的Memcached扩展

    Memcached是一个自由开源的,高性能,分布式内存对象缓存系统. Memcached是一种基于内存的key-value存储,用来存储小块的任意数据(字符串.对象).这些数据可以是数据库调用.API ...

  5. 【HDU 5730】Shell Necklace

    http://acm.hdu.edu.cn/showproblem.php?pid=5730 分治FFT模板. DP:\(f(i)=\sum\limits_{j=0}^{i-1}f(j)\times ...

  6. [BZOJ3167][P4099][HEOI2013]SAO(树形DP)

    题目描述 Welcome to SAO ( Strange and Abnormal Online).这是一个 VR MMORPG, 含有 n 个关卡.但是,挑战不同关卡的顺序是一个很大的问题. 有 ...

  7. 【最大流FF模板】HDU1532&POJ1273

    参照<挑战程序设计竞赛> #include<iostream> #include<cstdio> #include<cstdlib> #include& ...

  8. JVM入门——JVM内存结构

    一.java代码编译执行过程 1.源码编译:通过Java源码编译器将Java代码编译成JVM字节码(.class文件) 2.类加载:通过ClassLoader及其子类来完成JVM的类加载 3.类执行: ...

  9. 兼容各种浏览器下调用iframe里面的函数

    <script type="text/javascript"> var o = $(window.frames["menu"])[0].conten ...

  10. 把网页转换成图片或者pdf--wkhtmltopdf

    一.下载并安装wkhtmltopdf https://wkhtmltopdf.org/downloads.html 按照需要自己下载安装就可以了: 二.使用步骤--启动和生成图片或pdf 1.下载wk ...