杭电 1037 Online Judge 字符处理
来源:互联网 发布:淘宝转链接微信朋友圈 编辑:程序博客网 时间:2024/05/29 12:14
Online Judge
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.
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.
Output
For each test cases, you should output the the result Judge System should return.
Sample Input
4
START
1 + 2 = 3
END
START
1+2=3
END
START
1 + 2 = 3
END
START
1 + 2 = 3
END
START
1 + 2 = 3
END
START
1 + 2 = 4
END
START
1 + 2 = 3
END
START
1 + 2 = 3
END
Sample Output
Presentation Error
Presentation Error
Wrong Answer
Presentation Error
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ int l; cin>>l; getchar(); while(l--) { char a[10010],b[10010],c[10010],d[10010],e[10010]; gets(a); memset(b,0,sizeof(b)); while(gets(a)) { if(strcmp(a,"END")==0) break; if(strcmp(a,"END")!=0) strcat(b,a);//链接输入的 字符 strcat(b,"\n");//每个句末 都有一个换行 } memset(c,0,sizeof(c)); gets(a); while(gets(a)) { if(strcmp(a,"END")==0) break; if(strcmp(a,"END")!=0) strcat(c,a); strcat(c,"\n"); } if(strcmp(b,c)==0) { printf("Accepted\n"); continue; } int l=strlen(b); int h=strlen(c); memset(d,0,sizeof(d)); memset(e,0,sizeof(e)); int n=0,m=0,i; for(i=0;i<l;i++) { if(b[i]!=' '&&b[i]!='\n'&&b[i]!='\t')//保留有效的 字符 去除空格 回车 d[n++]=b[i]; } d[n]='\0'; for(i=0;i<h;i++) { if(c[i]!=' '&&c[i]!='\n'&&c[i]!='\t') e[m++]=c[i]; } e[m]='\0'; if(strcmp(e,d)==0) printf("Presentation Error\n"); else printf("Wrong Answer\n"); } return 0;}
- 杭电 1037 Online Judge 字符处理
- 杭电1073Online Judge
- 杭电1073 Online Judge
- 【ACM】杭电1073:Online Judge
- 杭电acm 1073Online Judge
- HDOJ/HDU 1073 Online Judge(字符串处理~)
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- Online Judge
- 杭电 1088 字符处理
- 题目1021题 统计字符 九度Online Judge
- 题目 1049 字符串去特定字符 九度Online Judge
- HDOJ 题目1073 Online Judge(字符串处理)
- 在online judge中建立简单数据结构,简单高效处理
- online judge制作手记
- 利用Druid实现应用和SQL监控
- Linux中Mysql安装与使用(CentOS-6.5:mysql-5.5.27)
- 在VMware中安装红帽Linux系统
- C语言之结构体struct
- 谈谈Spring中的IOC和AOP概念
- 杭电 1037 Online Judge 字符处理
- HTML5 Canvas 旋转的“金字塔”
- 异常处理
- java 单例模式和工厂模式
- Oracle ORA-错误表
- tomcat 启动时报Error starting static Resources错误
- Java开发规范说明
- 选择排序
- 没有域名和虚拟主机也能调试的微博授权