根据我的规律,每天solved3题就感觉不行了~但是今天好像做水题做上瘾了,不过PC的题目尽管水,水得还是可以让人有进步。

这题OJ自动测评真心坑,题目看起来十分简单,测评返回三种可能:

Accepted

Wrong Answer

Presentation Error

当输出字符完全相等,就是AC

当输出的数字字符按序相等,就是PE,

否则就是WA

坑爹就是坑在这个PE问题。

比如

3

1

1

1

1

111

这是PE的答案。。。不能仅仅是按行来比较,所以我,直接就拼在一个字符串了~当然,不拼也是很简单的。

/*******************************************************************************/
/* OS : 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 UTC 2013 GNU/Linux
* Compiler : g++ (GCC) 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
* Encoding : UTF8
* Date : 2014-03-30
* All Rights Reserved by yaolong.
*****************************************************************************/
/* Description: ***************************************************************
*****************************************************************************/
/* Analysis: ******************************************************************
*****************************************************************************/
/*****************************************************************************/ #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
using namespace std;
#define AC 0
#define WA 1
#define PE 2
void fun(int a,int cases)
{
switch(a)
{
case AC:
cout<<"Run #"<<cases<<": Accepted"<<endl;
break;
case PE:
cout<<"Run #"<<cases<<": Presentation Error"<<endl;
break;
case WA:
cout<<"Run #"<<cases<<": Wrong Answer"<<endl;
break; } }
bool isPE(string str1,string str2)
{
int i,flag=1;
int len1=str1.length(),len2=str2.length();
stack<int> stk1,stk2;
for(i=0; i<len1; i++)
if(str1[i]>='0'&&str1[i]<='9')
{
stk1.push(str1[i]-'0');
} for(i=0; i<len2; i++)
if(str2[i]>='0'&&str2[i]<='9')
{
stk2.push(str2[i]-'0');
}
if(stk1.size()!=stk2.size())return 0;
while(!stk1.empty())
{
if(stk1.top()!=stk2.top()) flag=0;
stk1.pop();
stk2.pop(); } return flag;
}
int main()
{ int n,i,m;
int cases=0;
vector<string> v_ans,v_sub; while(cin>>n&&n)
{ cases++;
v_ans.clear();
v_sub.clear();
v_ans.resize(n);
getchar();
for(i=0; i<n; i++)
{
getline(cin,v_ans[i]);
} cin>>m;
getchar(); v_sub.resize(m);
for(i=0; i<m; i++)
{
getline(cin,v_sub[i]);
} int nmin=n>m?m:n; //取数据最少比较
int nmax=n>m?n:m; v_sub.resize(nmax);
v_ans.resize(nmax); for(i=0; i<nmin; i++) //AC
{
if(v_ans[i]!=v_sub[i])
{
break;
}
}
if(i==nmin&&m==n)
{ fun(AC,cases);
continue; }
string tmp_a="",tmp_b="";
for(i=0; i<nmax; i++){
tmp_a=tmp_a+v_ans[i];
}
for(i=0; i<nmax;i++){
tmp_b=tmp_b+v_sub[i];
} if(isPE(tmp_a,tmp_b))
{
fun(PE,cases);
continue;
} fun(WA,cases); } return 0; }

再附上一些测试数据

2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 15
2
The answer is: 10
The answer is: 5
2
The answer is: 10
The answer is: 5
3
Input Set #1: YES
Input Set #2: NO
Input Set #3: NO
3
Input Set #0: YES
Input Set #1: NO
Input Set #2: NO
1
1 0 1 0
1
1010
1
The judges are mean!
1
The judges are good!
1
asd
1
asd
3
11
11
11
1
111111
3
11
12
13
4
11
12
13
14
3
11
12
13
4
11
1
2
13
0

测试输出

PC110305/UVA10188的更多相关文章

  1. [UVa10188]Automated Judge Script

    题目大意:叫你写一个判断答案的系统. 解题思路:模拟即可.AC条件为,答案条数相等,所有字符相等.PE条件为,答案条数可能不等,所有数字字符相等.其他为WA. UVa现在的C++已经不支持gets了, ...

随机推荐

  1. ios7 uuid的获取方法

    ios7后mac地址沦为鸡肋,所以必须得重新想办法获取设备的id信息,apple推荐用UUID,但app重新安装后,UUID需要重设,所以想到把UUID存储到ios系统的keychain中,既然存储在 ...

  2. php中的variables_order

    PHP中的$_ENV是一个包含服务器端环境变量的数组.它是PHP中一个超级全局变量,我们可以在PHP 程序的任何地方直接访问它.     $_ENV只是被动的接受服务器端的环境变量并把它们转换为数组元 ...

  3. [SAM4N学习笔记]UART的使用

    一.准备工作:      将上一节搭建的工程复制一份,命名为"3.uart".这一节主要讲如何使用SAM4N的UART功能,实现串口的收发. 二.程序编写: 细心看数据手册的朋友也 ...

  4. SRM 358(1-250,500pt)

    DIV1 250pt 题意:电视目前停留在第100台,有一个遥控器,可以向上或向下换台(需要按键一次),也可以按一些数字,然后直接跳到该台(需要按键次数等于数字数,不需要按确定键).但是,这个遥控一些 ...

  5. Yii PHP 框架分析(二)

    Yii PHP 框架分析(二)作者:wdy http://hi.baidu.com/delphiss/blog/item/54597af595085ad3f3d38552.html Yii是基于组件( ...

  6. Command-line interface

    A command-line interface (CLI), also known as command-line user interface, console user interface, a ...

  7. Git(一)环境搭建 + 常用命令

    上周研究了一下 Git,简单的使用了一下,个人感觉相对 SVN 来说还是有一定学习成本的,这次记录一些自己的学习过程以及常用的命令. 在学习的过程中,同事推荐了一个前辈写的教程([传送门]:Git教程 ...

  8. STL源码剖析之list的sort函数实现

    SGI  STL的list的函数的实现源码大致如下: //list 不能使用sort函数,因为list的迭代器是bidirectional_iterator, 而sort //sort函数要求rand ...

  9. Navicat远程连接MySQL数据库

    1.打开Navicat,在界面的“主机名和IP地址”处输入IP地址,一般是192.168.1.1 2.输入相应的用户名和密码,点击连接测试,确认是否已经连接,之后就可以点击确定了 3.找到相应的数据库 ...

  10. 实时的.NET程序错误监控产品Exceptionless开源了

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:实时的.NET程序错误监控产品Exceptionless开源了.