ZZNU 1163: 在线判题(指针专题)
题目描述
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".
输入
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.
输出
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: 在线判题(指针专题)的更多相关文章
- 在线判题系统hustoj的搭建
摘要:ACM/ICPC程序设计竞赛,越来越受到各个高校的重视,是程序设计竞赛中的奥林匹克.Hustoj是搭建在linux系统上的判题系统.能够判断代码的正确性.会及时返回通过或者不通过,如果不通过会返 ...
- 牛客网在线判题系统JavaScript(V8)使用
JavaScript作为一种弱类型的编程语言,语法和C/C++.JAVA等存在差别,但是对于大部算法题,不只是C/C++.JAVA,也依然可以使用JavaScript来实现.所以在牛客网中,如果你喜欢 ...
- 在线判题 (模拟)http://202.196.1.132/problem.php?id=1164
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #de ...
- YC大牛的判题任务-想法
YC大牛的判题任务 Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java class ...
- 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head。(注意,输出结果中请不要返回参数中的节点引用,否则判题程序会直接返回空)
// test20.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #include< ...
- LeetCode刷题 链表专题
链表专题 链表题目的一般做法 单链表的结构类型 删除节点 方法一 方法二 增加节点 LeedCode实战 LC19.删除链表的倒数第N个结点 解法思路 LC24.两两交换链表中的节点 解法思路 LC6 ...
- LeetCode刷题 树专题
树专题 关于树的几个基本概念 1 树的节点定义 2 关于二叉树的遍历方法 2.1 前序遍历 2.2 中序遍历 2.3 后序遍历 2.4 层序遍历 3 几种常见的树介绍 3.1 完全二叉树 3.2 二叉 ...
- 【dp专题】NOIP真题-DP专题练习
这里学习一下DP的正确姿势. 也为了ZJOI2019去水一下做一些准备 题解就随便写写啦. 后续还是会有专题练习和综合练习的. P1005 矩阵取数游戏 给出$n \times m$矩阵每次在每一行取 ...
- C语言指针专题——指针怎么就很灵活?
最近在研读 C Primer pkus(第五版)中文版,老外写的还是很经典的,推荐给朋友们,购买地址:C primer plus 5版中文版购买 另外再推荐两本书: 1. 2017年9月全国计算机二级 ...
随机推荐
- yeoman生成react基本架构
工欲善其事必先利其器.在开始react开始之前,我们先使用一系列的前段工具构建自己的前端集成解决方案. 环境配置: Bower,node js,npm,Grunt,Gulp,Yeoman 作者一直使用 ...
- python 数据聚合与分组
前面讲完了字符处理,但对数据进行整体性的聚合运算以及分组操作也是数据分析的重要内容. 通过数据的聚合与分组,我们能更容易的发现隐藏在数据中的规律. 数据分组 数据的分组核心思想是:拆分-组织-合并 首 ...
- 同时操作两个数据库:报错Illegal attempt to associate a collection with two open sessions
今天我在一个操作两个数据库的SSH里 同时插入1条数据 报错 Illegal attempt to associate a collection with two open sessions 在这里有 ...
- angular-ui-bootstrap插件API - Pagination
Pagination: 案例 <!DOCTYPE html> <html lang="en" ng-app="myApp"> <h ...
- java http url post json
import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import ja ...
- Alyona and copybooks
题目连接 题意: 给 n,a,b,c四个数,n为已有的书的数目,问再买k本书所需花费最少是多少,(k+n)%4==0: 有三种套餐 第一种只有一本书,花费a 第二种有两本书,花费b, 第三种有三本书, ...
- Filemon(Filemon文件系统监视)V7.04官方版
软件名称:Filemon(Filemon文件系统监视)V7.04官方版 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win 32位/64位 软件大小: 265KB 图片预览: 软件简介: ...
- Symfony没有安装依赖_PHP Fatal error: require(): Failed opening required
$ php bin/console server:run PHP Warning: require(D:\home\workspace\pd\app/../vendor/autoload.php): ...
- JDK根目录介绍
/bin 存放可执行程序(编译器javac.exe 运行器java.exe 文档生成器javadoc.exe等 ). /db 小型数据库文件. /jre JRE. /include 形成jdk的c. ...
- Let's Encrypt(开源SSL证书管理工具)
刚装上一个StartSSL 的证书没几天,却看到官方发出这样的通知: 无聊中看到了网上各种相关的扯淡: http://tieba.baidu.com/p/4801786642 http://www.t ...