根据我的规律,每天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. 路径和 二叉树 leecode

    题目不难,很快ac,纯粹靠手感.https://oj.leetcode.com/problems/sum-root-to-leaf-numbers/ /** * Definition for bina ...

  2. python爬虫学习(1)__抓取煎蛋图片

    #coding=utf-8 #python_demo 爬取煎蛋妹子图在本地文件夹 import requests import threading import time import os from ...

  3. curl伪造ip

    //随机IP function Rand_IP(){ $ip2id= round(rand(, ) / ); //第一种方法,直接生成 $ip3id= round(rand(, ) / ); $ip4 ...

  4. 2 weekend110的SecureCRTPortable远程连接 + 上传安装jdk + 上传安装配置hadoop

    企业公认的最新文本版本:        https://archive.apache.org/dist/ 玩玩这个远程连接软件,是个绿色软件. 别人已经做好了的. 解压之后, 下面,软件展示下, 这会 ...

  5. Spark RDD概念学习系列之rdd持久化、广播、累加器(十八)

    1.rdd持久化 2.广播 3.累加器 1.rdd持久化 通过spark-shell,可以快速的验证我们的想法和操作! 启动hdfs集群 spark@SparkSingleNode:/usr/loca ...

  6. Apache 虚拟主机 VirtualHost 配置

    虚拟主机 (Virtual Host) 是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同 ...

  7. 模仿GsonConverter 写的StringConverter 解析String字符串

    使用自己写的StringConverter 来封装的 Converter 来解析String private static final RestAdapter CAMERA_CLIENT_NETWOR ...

  8. Code Forces Gym 100971D Laying Cables(单调栈)

    D - Laying Cables Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u ...

  9. getaccesstoken方法

    通过appid和appsecret获取access_token的定义函数 这里用的是memcache缓存存储用户信息7000秒 <?php function getAccessToken($ap ...

  10. Android 在广播接收器中弹出对话框

    特别需要注意的几点如下: 需要设置AlertDialog的类型 WindowManager.LayoutParams.TYPE_SYSTEM_ALERT 2. 需要声明Window弹框的权限 < ...