题目描述

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.

输入

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.

输出

For each test cases, you should output the the result Judge System should return.

样例输入

START
+ =
END
START
+=
END
START
+ =
END
START
+ = END
START
+ =
END
START
+ =
END
START
+ =
END
START
+ =
END
样例输出
Presentation Error
Presentation Error
Wrong Answer
Presentation Error

题目链接:http://acm.zznu.edu.cn/problem.php?id=1163

*************************************************

题意:OJ的判题系统,只判 AC , WA ,PE。将所有的字符读入(包括回车)到一个字符串中,逐个比较,如果完全相同 AC , 如果只有space , '\t' 或者 '\n'处不同则 PE 否则 WA

分析:第二行空相当于一个'\0',所以我们要写个循环把每一行的值都存入相同一个串,再比较。

AC代码:

 #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include<limits.h>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <vector>
#include <queue>
#include <map> using namespace std; #define N 10000
#define INF 0x3f3f3f3f
#define met(a, b) memset (a, b, sizeof (a))//// met (dist, -1);
#define LL long long char a[N],b[N],s[],str[N],str1[N]; int main()
{
int T,i,j,len;
scanf("%d", &T);
getchar(); while(T--)
{
int k=,l=,f=; memset(a,'',sizeof(a));
memset(b,'',sizeof(b));
gets(s);
while(gets(str))
{
if(strcmp(str,"END")==)
break;
len=strlen(str);
for(i=;i<=len;i++)
a[k++]=str[i];
} gets(s);
while(gets(str1))
{
if(strcmp(str1,"END")==)
break; len=strlen(str1);
for(i=;i<=len;i++)
b[l++]=str1[i];
} for(i=,j=; i<=k&&j<=l;)
{
if(a[i] != b[j])
{
if(a[i] == ' '||a[i] == '\0'||a[i] == '\t')
{
i++;
f=;
}
else if(b[j]==' '||b[j]=='\0'||b[j]=='\t')
{
j++;
f=;
}
else
{
f=;
break;
}
}
else
{
i++;
j++;
}
} if(f==)
printf("Accepted\n");
else if(f==)
printf("Presentation Error\n");
else if(f==)
printf("Wrong Answer\n"); }
return ;
}

ZZNU 1163: 在线判题(指针专题)的更多相关文章

  1. 在线判题系统hustoj的搭建

    摘要:ACM/ICPC程序设计竞赛,越来越受到各个高校的重视,是程序设计竞赛中的奥林匹克.Hustoj是搭建在linux系统上的判题系统.能够判断代码的正确性.会及时返回通过或者不通过,如果不通过会返 ...

  2. 牛客网在线判题系统JavaScript(V8)使用

    JavaScript作为一种弱类型的编程语言,语法和C/C++.JAVA等存在差别,但是对于大部算法题,不只是C/C++.JAVA,也依然可以使用JavaScript来实现.所以在牛客网中,如果你喜欢 ...

  3. 在线判题 (模拟)http://202.196.1.132/problem.php?id=1164

    #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #de ...

  4. YC大牛的判题任务-想法

    YC大牛的判题任务 Time Limit: 1000ms Memory Limit: 65536KB   64-bit integer IO format: %lld      Java class ...

  5. 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head。(注意,输出结果中请不要返回参数中的节点引用,否则判题程序会直接返回空)

    // test20.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #include< ...

  6. LeetCode刷题 链表专题

    链表专题 链表题目的一般做法 单链表的结构类型 删除节点 方法一 方法二 增加节点 LeedCode实战 LC19.删除链表的倒数第N个结点 解法思路 LC24.两两交换链表中的节点 解法思路 LC6 ...

  7. LeetCode刷题 树专题

    树专题 关于树的几个基本概念 1 树的节点定义 2 关于二叉树的遍历方法 2.1 前序遍历 2.2 中序遍历 2.3 后序遍历 2.4 层序遍历 3 几种常见的树介绍 3.1 完全二叉树 3.2 二叉 ...

  8. 【dp专题】NOIP真题-DP专题练习

    这里学习一下DP的正确姿势. 也为了ZJOI2019去水一下做一些准备 题解就随便写写啦. 后续还是会有专题练习和综合练习的. P1005 矩阵取数游戏 给出$n \times m$矩阵每次在每一行取 ...

  9. C语言指针专题——指针怎么就很灵活?

    最近在研读 C Primer pkus(第五版)中文版,老外写的还是很经典的,推荐给朋友们,购买地址:C primer plus 5版中文版购买 另外再推荐两本书: 1. 2017年9月全国计算机二级 ...

随机推荐

  1. 使用JavaScript重定向URL参数

    本人从网上查找(如有雷同,不胜荣幸.),并进行了修改,简单粗暴,实现使用JavaScript重置url参数 1.字符拼接形式 function setUri(para, val) { var strN ...

  2. C语言之分支结构 if(一)

    一 程序的三种基本结构 顺序结构:程序从上往下依次执行,这个叫顺序结构 分支结构:有选择的执行或者不执行某段代码 循环结构:重复的执行某段代码 二 分支结构之if 最简单的俩种用法 (tips: if ...

  3. PHP绿色集成环境在云服务器上的应用,PHPWAMP在服务器上搭建网站案例

    问:什么叫WAMP?答:Windows下的Apache+Mysql+PHP,称之为WAMP. 本文案例采用的PHP集成环境是我自己开发的纯绿色版WAMP软件(PHPWAMP). 我在这款集成环境里集成 ...

  4. 《如何阅读一本书》(How to Read a Book)

    值得一读的书,有深入浅出,也有并不能完全读懂的部分,以下是第11章对之前内容的总结整理. 阅读的层次 1. 基础阅读 2. 检视阅读 3. 分析阅读 4. 主题阅读 分析阅读 第一阶段:这本书在谈些什 ...

  5. [留念贴] C#开发技术期末大作业——星月之痕

    明天就要去上海大学参加 2015赛季 ACM/ICPC最后一场比赛 —— EC-Final,在这之前,顺利地把期末大作业赶出来了. 在这种期末大作业10个人里面有9个是从网上下载的国内计算机水平五六流 ...

  6. 用备份控制文件做不完全恢复下的完全恢复(全备<老>--备份控制文件<次新>--删除表空间andy--日志文件<新>)

    为什么会使用备份的控制文件? 实际工作中主要有两种情况:第一种:当前控制文件全部损坏,而数据文件备份,控制文件备份及当前日志处于不同SCN版本,它们之间又增加过表空间(数据文件).第二种:当前控制文件 ...

  7. liunx系统磁盘满的时候如何排查

    第一步:查看磁盘总体情况 命令: df -lh 可以看出/dev/vda1, 不过这是个设备的名称不是对应的目录,其实/dev/vda1设备对应的目录名称是/home下面 或者可以全局搜索哪个目录下面 ...

  8. typeJavaScript笔记----字符串,参数,函数,表达式,循环

    一.字符串新特性--双丿(撇)号声明字符串 .多行字符串 var myName = `fang my hao li jsk c sdf` //这样不会报错. .字符串模板 console.log(`q ...

  9. 端口(port)的安全模式(security mode)

    1. Cisco29系列交换机可以做基于2层的端口安全 ,即mac地址与端口进行绑定.2. Cisco3550以上交换机均可做基于2层和3层的端口安全, 即mac地址与端口绑定以及mac地址与ip地址 ...

  10. xml动态修改 dom4j修改

    xml的动态修改需要传入的参数 xml的位置(tomcat中的发布位置).修改后的xml需要保存的位置(因为动态修改,所以建议和xml未修改前的位置相同).添加的节点的信息.或者修改的节点的信息 SA ...