HDOJ1073(Online Judge)(模拟+容器的使用)
来源:互联网 发布:aix java 环境变量 编辑:程序博客网 时间:2024/05/01 00:20
Online Judge
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6453 Accepted Submission(s): 2440
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.
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.
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
4START1 + 2 = 3ENDSTART1+2=3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 4ENDSTART1 + 2 = 3ENDSTART1+2=3END
Sample Output
Presentation ErrorPresentation ErrorWrong AnswerPresentation Error
getline()函数用于输入流,读取字符到buffer中,直到下列情况发生:
用容器进行操作简单了许多也比较好理解。
- num - 1个字符已经读入,
- 碰到一个换行标志,
- 碰到一个EOF,
- 或者,任意地读入,直到读到字符delim。delim字符不会被放入buffer中。
#include<iostream>#include<string>#include<vector>using namespace std;vector<string> v1,v2;int main(){string s,str1,str2;int test;cin>>test;while(test--){while(getline(cin,s)){if(s=="START") continue;if(s=="END") break;v1.push_back(s);for(int i=0;i<s.length();i++){if(s[i]!=' '&&s[i]!='\t') str1+=s[i];}}while(getline(cin,s)){if(s=="START") continue; if(s=="END"){if(v1==v2) printf("Accepted\n");else if(str1==str2) printf("Presentation Error\n");else printf("Wrong Answer\n");break;}v2.push_back(s);for(int i=0;i<s.length();i++){if(s[i]!=' '&&s[i]!='\t') str2+=s[i];}}v1.clear(),v2.clear();str1.resize(0),str2.resize(0); }}
0 0
- HDOJ1073(Online Judge)(模拟+容器的使用)
- hdoj1073 Online Judge(对字符串的操作问题)
- 在线提交系统(Online Judge)
- 几个比较大的在线提交系统(Online Judge)
- 转: 几个比较大的在线提交系统(Online Judge)
- hdoj 1073 online judge (刻骨铭心的水题)
- TongJI Online Judge预赛(3): Game
- TongJI Online Judge预赛(3): Game
- My Online Judge (GUET OJ)
- HDU 1073 Online Judge(字符串)
- online judge汇总(在线答题)
- HDU 1073 Online Judge(水~)
- 推荐一家日本的online judge:aizu online judge
- 关于Online Judge 的Tips
- 程序员的Job Security - 我的OJ(Online Judge)比较
- 基于java的ACM online judge(OJ)在线判题系统实现
- online judge(ACM) 的设计与分析 (有c#demo)
- 杭州电子科技大学Online Judge 之 “漂浮的气球(ID1004)”解题报告
- 附近QQ采集软件/QQ附近人采集软件
- Jdk安装与环境变量配置
- swift基本语法
- 阻止qTip将 title 变成 oldtitle
- android WindowManager解析与骗取QQ密码案例分析
- HDOJ1073(Online Judge)(模拟+容器的使用)
- 欢迎使用CSDN-markdown编辑器
- dom4j解析xml
- Swift Playground
- JavaScript对SEO的影响及解决之道
- AngularJS学习笔记(一)
- python实现base64加密/解密界面化小工具
- NSURLSession学习笔记(一)简介
- 算法之美隆重上市欢迎关注(另附勘误表在此)