根据我的规律,每天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. 一些简单的css和js知识

    这几天主要做的是前端网页的调整和页面UI的优化方面的内容.这中间主要是学习了一些基本的HTML和css样式的基本元素的属性.设置行高的line-heght属性,设置窗口的浮动用position属性,设 ...

  2. Hdu 4311-Meeting point-1 曼哈顿距离,前缀和

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4311 Meeting point-1 Time Limit: 2000/1000 MS (Java/Oth ...

  3. nodejs 基本问题答疑

    传统服务器架构1.服务器接到请求2.创建一个新的响应程序的实例 node服务器架构1.服务器接到请求2.检查处理程序是否存在,如果存在直接处理,不存在则创建. node的做法节省了内存 ubuntu下 ...

  4. 我最喜欢的visual studio 2013的新特性

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:我最喜欢的visual studio 2013的新特性.

  5. 初识jQuery,八字真言“选择元素,对其操作”

    jQuery在我印象中,就是很多类似$(),然后昨天开始接触了,觉得很和谐,获取元素比JavaScript简单很多,有意思. 一.开始学习jQuery,下载jQuery库的文件 http://jque ...

  6. IOS关于XIB文件和调试时候显示不一样问题

    1 前言 今天工作中,遇到了一个xib文件布局问题,具体问题如下:在xib中加了一个图片,背景为已经切好的图片,但是当显示在模拟器上面的时候却显示不出来效果. 2 详述 2.1 问题截图      如 ...

  7. 使用Parse内付费服务出现的Error Domain=Parse Code=146 "The operation couldn’t be completed. (Parse error 146.)

    因为开发一个应用有个内付费去广告功能,介于苹果官方提供的方法没用过,感觉有些复杂,于是选用了第三方组件Parse来解决这个问题,简单易操作: Parse简化苹果官方内付费问题,使用方法分厂简单只有两个 ...

  8. [Javascript] Immutable opreators

    slice filter map ...spread concat Object.assign let items = [1,2,3]; //add let newItems = [...items, ...

  9. soap实例入门(转)

    SOAP的HelloWord实例- - 1.1  前言 2005-3-2公司开会并分给我一个任务:写一个程序从福建移动的BOSS系统取出一些相关数据.我得到的资料仅仅有一个“福建移动BOSS与业务增值 ...

  10. Chapter 4 - How to Fire some Bullets

    Now, we want to let the hero fire some bullets to kill the enemies, add the codes below to set the l ...