题目大意:叫你写一个判断答案的系统。

解题思路:模拟即可。AC条件为,答案条数相等,所有字符相等。PE条件为,答案条数可能不等,所有数字字符相等。其他为WA。

UVa现在的C++已经不支持gets了,于是CE了几发。C++11仍然支持,所以下面代码需在C++11下评测。

C++ Code:

#include<cstdio>
#include<cctype>
#include<cstring>
using namespace std;
int n,m;
char a[102][130],b[102][130],s[3],ap[20000],bp[20000];
const char ans[][30]={"Accepted","Wrong Answer","Presentation Error"};
int p;
bool ac(){
if(n!=m)return false;
for(int i=0;i<=n;++i)
for(int j=0;a[i][j]||b[i][j];++j)
if(a[i][j]!=b[i][j])return false;
return true;
}
bool pe(){
int cnta=0,cntb=0;
for(int i=1;i<=n;++i)
for(int j=0;a[i][j];++j)if(isdigit(a[i][j]))ap[++cnta]=a[i][j];
for(int i=1;i<=m;++i)
for(int j=0;b[i][j];++j)if(isdigit(b[i][j]))bp[++cntb]=b[i][j];
if(cnta!=cntb)return false;
for(int j=1;j<=cnta;++j)if(ap[j]!=bp[j])return false;
return true;
}
int main(){
int t=0;
while(scanf("%d",&n)&&n){
gets(s);
for(int i=1;i<=n;++i)gets(a[i]);
scanf("%d",&m);
gets(s);
for(int i=1;i<=m;++i)gets(b[i]);
if(ac())p=0;else
if(pe())p=2;else
p=1;
printf("Run #%d: %s\n",++t,ans[p]);
memset(a,0,sizeof a);
memset(b,0,sizeof b);
}
return 0;
}

[UVa10188]Automated Judge Script的更多相关文章

  1. UVa 10188 - Automated Judge Script

    题目:给你一些题目的输出结果,推断是AC,PE还是WA. 分析:模拟. 依照题意模拟就可以,注意PE条件为全部数字字符出现顺序同样就可以. 说明:想起非常多年前写的OJ的后台判题程序了╮(╯▽╰)╭. ...

  2. (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO

    http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年 ...

  3. ACM训练计划step 1 [非原创]

    (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成 ...

  4. 算法竞赛入门经典+挑战编程+USACO

    下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinej ...

  5. linux commands

    abrt-cli --since ;查看abrt捕捉的异常 alias ;别名,alias rm='rm -i':使用“ \rm ” 使用原命令 alsamixer ;图形音量调节,q 增加左声道, ...

  6. 一个很简单的php留言板。。。。搭建在sae上的。。。

    我在sae上搭建了一个个人简历的页面: 有兴趣的可以访问  http://671coder.sinaapp.com/ 在做下面一个简单的留言板的时候,卡了我很久,虽然完全没用过php..但是还是最后勉 ...

  7. 【Python】Camera拍照休眠唤醒测试

    #!/usr/bin/python # -*- coding: UTF-8 -*- import os import sys import time rebootCount = int(input(& ...

  8. Expect Command And How To Automate Shell Scripts Like Magic

    In the previous post, we talked about writing practical shell scripts and we saw how it is easy to w ...

  9. Linux Expect自动交互脚本

    https://likegeeks.com/expect-command/ In the previous post, we talked about writing practical shell ...

随机推荐

  1. 将数据内容动态添加到HTML中

    // 申明一个数组用来装遍历的元素 var li = []; //遍历元素并加载到标签中 for(var i = 0; i<navGroup.self_first_nav.length; i++ ...

  2. Linux后台开发应该具备技能

    一.linux和os: 1.命令:netstat tcpdump ipcs ipcrm 这四个命令的熟练掌握程度基本上能体现实际开发和调试程序的经验 2.cpu 内存 硬盘 等等与系统性能调试相关的命 ...

  3. com.jasson.im.api.APIClient jar包 下载

    包名:ImApi2.3.jar 链接: https://pan.baidu.com/s/1SgeufcaH6y_K-AJEKDZDtw 提取码: 3v78 复制这段内容后打开百度网盘手机App,操作更 ...

  4. javascript 中一些奇葩的日期换算

    1.获取今天的0时0分0秒(常用于开始日期的获取) new Date(new Date().toLocaleDateString()); // Mon Nov 12 2018 00:00:00 GMT ...

  5. django-2-路由配置及渲染方式

    <<<视图>>> (1)首先要注册创建好的app (2)配置路由 在app目录下新建一个urls.py模块 模块里面复制myproject目录下urls.py里面的 ...

  6. SpringBoot2.0中使用订阅redis的多个频道的消息

    声明:参考文章:https://blog.csdn.net/myNameIssls/article/details/75471012?locationNum=2&fps=1 一·使用maven ...

  7. java类的属性

    类的嵌套!!!!!!!!!! 首先我们创建一个学生卡卡号的一个类,这个类有两个属性,校园卡号和银行卡号 package cuteSnow; public class StudentCard { pub ...

  8. Ubuntu 安装 Courier New字体和雅黑consolas字体

    一直觉得Ubuntu下的字体不是很好,但毕竟不影响使用,然后作开发的时候eclipse的字体完全没有windows下的两大适合编成的字体courier new 和consloas .可以使用系统安装字 ...

  9. Reentrant protected mode kernel using virtual 8086 mode interrupt service routines

    A method for allowing a protected mode kernel to service, in virtual 8086 mode, hardware interrupts ...

  10. 工具-WIN7-内存占用过高解决办法

    我的WIN7内存竟然吃到了7.6G,太不可思意了 第一步 看看网上的解决办法 http://jingyan.baidu.com/article/870c6fc31060eab03fe4beee.htm ...