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月全国计算机二级 ...
随机推荐
- mysql关联删除
<delete id="deleteBatchUserOfSp" parameterType="java.lang.String" > delete ...
- “Will not add file alias 'samefile' ('SameFile' already exists in index)” when `git add/commit` operation
从远程仓库pull下来的代码有两个类类名首字母小写出现如下情况 然后我想删了重新写一下(就是把这个类删了,代码复制到名字正确的类里面),然后commit的时候出现这个错误,后来删一个commit一下, ...
- 【汇编语言】DEBUG的使用
在masm for windows中,需要先生存exe文件,然后再点调试按钮. 常用的命令有: R命令:查看.改变CPU寄存器的内容:如果要修改某个寄存器的内容,可以在r的后面接上空格和寄存器名.如: ...
- HTML5 智能表单
HTML5 智能表单 1.表单新增属性 ☀ autofocus 属性 <input type="text" autofocus/>设置 autofocus 属性,使文 ...
- angular 格式化日期
参考:http://blog.csdn.net/zk437092645/article/details/37882191 html: <input type="text" d ...
- HttpURLConnection传JSON数据
try { //创建连接 URL url = new URL(url); HttpURLConnection connection = (HttpURLConnection) url.openConn ...
- 初识git--基础命令
重要:远程分支是一些无法移动的本地分支,本地分支,本地分支,三遍!是对远程库中分支的索引,只有在git进行网络交互时才会更新,用 (远程仓库名)/(分支名) 这样的形式表示远程分支 一.基础命令1 1 ...
- express 4.x 文件上传
1.安装文件上传模块: npm install multiparty --save 2.在routes/index.js 中添加: // 引用模块 let multiparty = require(& ...
- java--调整JVM内存的大小
默认占用:64M的内存 修改内存的方式: 1.某一类,右键选择--Run Configurations 2.选择--Arguments 3.在VM argments中输入内容,如:-Xmx80m
- 前端之Photoshop切片
什么是切片 ? (Photoshop中的切片) 切片:将图片切成几部分,一片一片往上传,这样上传的速度比较快.每个切片作为一个独立的文件传输,文件中包含切片自己的设置.颜色调板.链接.翻转效果 ...