Hdoj Title Address: Portal
Online JudgeTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total Submission (s): 6939 Accepted Submission (s): 2655
Problem Descriptionignatius is building a Online Judge, now he had 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 other files. If the files is absolutly same, then the Judge System return "Accepted", else if the only differences between the Files are spaces ('), tabs (' \ t '), or enters (' \ n '), the Judge system should return "Presentation Error", else the system Would return "wrong Answer".
Given the data of correct output file and the data of the user ' s result file, your task is to determine which result the Judge System would return.
Inputthe input contains several test cases. The first line of the input was a single integer T which is the number of test cases. T test Cases follow.
Each test case has a parts, the data of correct output file and the data of the user ' s result file. Both of them is starts with a single line contains a string "START" and end with a single line contains a string "End", t Hese strings is not the data. In and words, the data is between the strings. The data would at most characters.
Outputfor Each test cases, you should output 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
#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 = W F = 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; String sa_s,sb_s; SA_S=SA;SB_S=SB; if (Sa_s.compare (sb_s)!=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;}
Acm--oj Award--hdoj 1073--online judge--string