杭电1073 Online Judge
来源:互联网 发布:js创建json数组对象 编辑:程序博客网 时间:2024/05/29 09:57
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<stdio.h>#include<string.h>int main(){int i,j,k,t,len;char ch[2][1010],temp[1010];scanf("%d",&t);getchar();while(t--){for(i=0;i<2;++i){strcpy(ch[i],"");gets(temp);while(strcmp(temp,"START")!=0){gets(temp);}gets(temp);while(strcmp(temp,"END")!=0)//START和END之间可能有很多东西 {strcat(ch[i],temp);//拼接两个字符串 strcat(ch[i],"\n");//因为gets是整行读取,所以如果START和END之间还有的话 就有\n gets(temp);}}if(strcmp(ch[0],ch[1])==0)printf("Accepted\n");else {for(i=0;i<2;++i){k=0;//k=0一定要放在这里,每次都要初始化 len=strlen(ch[i]);for(j=0;j<len;++j){if(ch[i][j]==' '||ch[i][j]=='\t'||ch[i][j]=='\n'){continue;} ch[i][k++]=ch[i][j];}ch[i][k]='\0';}if(strcmp(ch[0],ch[1])==0) printf("Presentation Error\n");elseprintf("Wrong Answer\n");} }return 0;}
0 0
- 杭电1073Online Judge
- 杭电1073 Online Judge
- 【ACM】杭电1073:Online Judge
- 杭电acm 1073Online Judge
- 杭电 1037 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
- hdu 1073 Online Judge
- hdu 1073 Online Judge
- HDU 1073 Online Judge
- SSH无密码登录,SCP无密码传输
- cmd下ftp加端口小技巧
- jsp常用指令
- 然而马云并没有收购车投网
- 11g RAC 加节点 之 手动添加vip 资源
- 杭电1073 Online Judge
- MFC学习笔记.day03-菜单,图形标记菜单创建,菜单栏禁用,命令响应,右键弹出菜单,添加菜单
- ZOJ-1002 Fire Net
- phpstrom内置服务器的坑
- 文章标题
- tomcat中建立基于端口号的虚拟主机
- 一个ORM的实现(附源代码)
- 编写nios-shell时想到的问题-回车vs换行
- HDU 1754 I Hate It(线段树)