HDU 1073 Online Judge (字符串处理,格式判断的好题!!!!)
来源:互联网 发布:自学漫画的软件 编辑:程序博客网 时间:2024/05/22 16:53
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
#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;const int N=10000+10;char temp[N];char a1[N],a2[N],b1[N],b2[N];void input(char a[],char b[]){gets(temp);while(strcmp(temp,"START")!=0) gets(temp);while(gets(temp)) {if(strcmp(temp,"END")==0) break;if(strlen(temp)!=0)strcat(a,temp);strcat(a,"\n");}int k=0,n=strlen(a);for(int i=0;i<n;i++) {if(a[i]!=' ' && a[i]!='\t' && a[i]!='\n') b[k++]=a[i];}b[k]='\0';}int main(){int t;scanf("%d",&t);while(t--) {a1[0]=a2[0]=b1[0]=b2[0]='\0';input(a1,b1);input(a2,b2);if(strcmp(a1,a2)==0) printf("Accepted\n");else if(strcmp(b1,b2)==0) printf("Presentation Error\n");else printf("Wrong Answer\n");}return 0;}
0 0
- HDU 1073 Online Judge (字符串处理,格式判断的好题!!!!)
- HDOJ/HDU 1073 Online Judge(字符串处理~)
- HDU 1073 Online Judge(字符串)
- HDU--1073:Online Judge (字符串)
- HDU 1073 Online Judge(字符串输入方面的经验)
- HDU ACM 1073 Online Judge ->字符串水题
- 【水题-字符串】HDU 1073 Online Judge
- HDOJ 题目1073 Online Judge(字符串处理)
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- HDU 1073 Online Judge
- HDU 1073 Online Judge
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- 通过Baseadpter自定义Adapter适配器的学习笔记
- java学习—day_2
- CodeForces 613A Peter and Snow Blowe
- Ubuntu Server下搭建LAMP环境
- 简易调试器的实现
- HDU 1073 Online Judge (字符串处理,格式判断的好题!!!!)
- 免费接口API
- java学习—day_3
- Java 抽象类和接口的区别
- 在 Xcode 7.x 中安装 Alcatraz
- 上传本地项目到github
- Andorid动画——补间动画与帧动画
- BindingFlags说明
- Tomcat 系统架构与设计模式,第 2 部分: 设计模式分析