根据我的规律,每天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. Implement the hash table using array / binary search tree

    今天在复习Arrays and String 时看到一个很有趣的问题.希望跟大家分享一下. Implement the hash table using array / binary search t ...

  2. Spark RDD/Core 编程 API入门系列之map、filter、textFile、cache、对Job输出结果进行升和降序、union、groupByKey、join、reduce、lookup(一)

    1.以本地模式实战map和filter 2.以集群模式实战textFile和cache 3.对Job输出结果进行升和降序 4.union 5.groupByKey 6.join 7.reduce 8. ...

  3. python的import与from...import的不同之处

    在python用import或者from...import来导入相应的模块.模块其实就是一些函数和类的集合文件,它能实现一些相应的功能,当我们需要使用这些功能的时候,直接把相应的模块导入到我们的程序中 ...

  4. PHP面试题二

    1.抓取远程图片到本地,你会用什么函数? fsockopen, A 2.用最少的代码写一个求3值最大值的函数. function($a,$b,$c){ * W0 z* u6 k+ e. L  a: } ...

  5. 用Y分钟学会X

    Learn X in Y minutes是一个有趣的网站,里面列举了对很多编程语言和工具的极简教程,有各种语言版本的.

  6. 大陆用户如何下载Google Play中的apk文件

    利用一些中转网站完成,具体原理可能是以手机虚拟机形式下载,然后提取app,给出下载链接,不过知不知道原理不重要,反正都是被墙. 这里给出测试可用的网站apkpure(20160714) http:// ...

  7. 会话数据的保存——cookie

    会话的理解 可以简单的理解为:用户打开浏览器,访问多个web资源,然后关闭浏览器,这个过程可以称为一次会话 有状态会话:可以简单理解为一个同学来了这个教室,下一次再来我们知道他来过这个教室,我们可以称 ...

  8. GWT事件处理

    package com.zly.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.do ...

  9. myeclipes使用过程中的错误解决方案

    1.‘Building workspace’ has encountered a problem. Errors occurred during the build. 解决方案:这样的错误,主要是由于 ...

  10. ARCproject中加入非ARC文件,或者非ARC环境中加入ARC文件

    ARC与非ARC在一个项目中同一时候使用, 选择项目中的Targets,选中你所要操作的Target,选Build Phases,在当中Complie Sources中选择须要ARC的文件双击,并在输 ...