HDU1073 Online Judge【输入输出+字符串】
来源:互联网 发布:淘宝不允许好评返现 编辑:程序博客网 时间:2024/05/22 07:00
Online Judge
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8329 Accepted Submission(s): 3085
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.
InputGiven 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.
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.
OutputEach 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.
For each test cases, you should output the the result Judge System should return.
Sample Input4START1 + 2 = 3ENDSTART1+2=3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 3ENDSTART1 + 2 = 4ENDSTART1 + 2 = 3ENDSTART1+2=3END
Presentation ErrorPresentation ErrorWrong AnswerPresentation Error
Ignatius.L
问题链接:HDU1073 Online Judge。
题意简述:参见上文。
问题分析:这是一个有关输入输出以及字符串处理的问题。程序说明:(略)
题记:(略)AC的C++语言程序如下:
/* HDU1073 Online Judge */#include <iostream>#include <string.h>using namespace std;const string START = "START";const string END = "END";const int N = 5000;string a1, a2;char b1[N+1], b2[N+1];void input(string& a, char b[]){ string s; getline(cin, s); while(s != START) getline(cin, s); a = ""; while(getline(cin, s)) { if(s == END) break; a += s + "\n"; } int i = 0, j = 0; while(a[i]) if(a[i] != ' ' && a[i] != '\t' && a[i] != '\n') b[j++] = a[i++]; else i++; b[j] = '\0';}int main(){ int t; cin >> t; while(t--) { input(a1, b1); input(a2, b2); if(a1 == a2) printf("Accepted\n"); else if( strcmp(b1, b2) == 0) printf("Presentation Error\n"); else printf("Wrong Answer\n"); } return 0;}
阅读全文
0 0
- HDU1073 Online Judge【输入输出+字符串】
- Online Judge hdu1073 字符串操作
- HDU1073:Online Judge
- hdu1073 Online Judge
- HDU1073 Online Judge
- HDU1073 Online Judge
- hdu1073 Online Judge 一道字符串处理的水题,,wa了我一下午。。。这几天发生了点不寻常的事。
- HDU--1073:Online Judge (字符串)
- HDU 1073 Online Judge(字符串)
- 【水题-字符串】HDU 1073 Online Judge
- HDOJ/HDU 1073 Online Judge(字符串处理~)
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- HDU1073
- 慕课HTML基础知识复习
- fabric 开发环境
- 葵花宝典 六
- jsp session
- jQuery
- HDU1073 Online Judge【输入输出+字符串】
- 道路重建
- 机器学习的动机与应用
- cc3200系列教程之制作bootloader简介
- linux之cut用法
- Gallery3d 学习笔记
- Java学习笔记-《Java程序员面试宝典》-第5章Java Web-5.3框架(5.3.1-5.3.2)
- python入门系列16―——格式化
- (OK) Android-x86-7.1.1/ kernel 4.4.62