HDU 1073 - Online Judge
模拟评测机判断答案
先判断有没有不一样的
有的话再提取出 有效子列 看看有没有错的
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int t;
string a,b,sa,sb;
char s[];
const char p[][]={"Accepted","Presentation Error","Wrong Answer"};
void getstring(string& a)
{
while(gets(s))
{
if(!strcmp(s,"START")) break;
}
while()
{
gets(s);
if(!strcmp(s,"END")) break;
a+=s;
a+='\n';
}
}
void getsub(string& a,string& sa)
{
int len=a.length();
for(int i=;i<len;i++)
{
if(a[i]==' '||a[i]=='\t'||a[i]=='\n') continue;
sa+=a[i];
}
}
int main()
{
scanf("%d",&t);
int i,j,lena,lenb;
while(t--)
{
a.clear(); sa.clear();
b.clear(); sb.clear();
getstring(a);
getstring(b);
lena=a.length();
lenb=b.length();
int ans=;
if(lena!=lenb) ans=;
else {
for(i=;i<lena;i++)
{
if(a[i]!=b[i])
{
ans=; break;
}
}
}
if(ans)
{
getsub(a,sa);
getsub(b,sb);
int lsa=sa.length(), lsb=sb.length();
if(lsa!=lsb) ans=;
else{
for(i=;i<lsa;i++)
{
if(sa[i]!=sb[i])
{
ans=; break;
}
}
}
}
printf("%s\n",p[ans]);
}
}
HDU 1073 - Online Judge的更多相关文章
- 解题报告:hdu 1073 Online Judge
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073 Problem Description Ignatius is building an Onli ...
- HDOJ/HDU 1073 Online Judge(字符串处理~)
Problem Description Ignatius is building an Online Judge, now he has worked out all the problems exc ...
- HDU 1073 Online Judge (字符串处理)
题目链接 Problem Description Ignatius is building an Online Judge, now he has worked out all the problem ...
- HDU 1073 Online Judge(字符串)
Online Judge Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- HDU ACM 1073 Online Judge ->字符串水题
分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...
- HDU 1073
http://acm.hdu.edu.cn/showproblem.php?pid=1073 模拟oj判题 随便搞,开始字符串读入的细节地方没处理好,wa了好久 #include <iostre ...
- 【HDOJ】1073 Online Judge
这道题TLE了N多次,完全不明白为什么,稍微改了一下,居然过了.使用gets过的,看讨论帖有人还推荐用hash. #include <stdio.h> #include <strin ...
- hdu 1073 字符串处理
题意:给一系列的输出和标准答案,比较二者是AC,PE或WA 字符串处理还是比较薄弱,目前没什么时间搞字符串专题,所以遇到一题就努力搞懂 #include<cstdio> #include& ...
- 并查集---体会以及模板&&How Many Tables - HDU 1213
定义&&概念: 啥是并查集,就是将所有有相关性的元素放在一个集合里面,整体形成一个树型结构,它支持合并操作,但却不支持删除操作 实现步骤:(1)初始化,将所有节点的父亲节点都设置为自己 ...
随机推荐
- 进阶笔记(1)——JavaScript 语言精碎
调用:(调用一个函数将暂停当前函数的执行,传递控制权和参数给新函数) 每个函数接受连个附加参数:this (取决于调用的模式).argument. js的四种调用模式及this指向: 1.方法调用:( ...
- C++学习笔录4
1.容器=数据结构+算法.相当于是为复杂的数据设计一种专门用于存放该数据的东西.用于开发中传递复杂的数据. 2.模版函数只能写在头文件中.不能单独做声明. 3.STL容器类分为三类: (1).顺序容器 ...
- Niagara AX之BajaScript资料哪里找
四个步骤:(开篇:多谢陈工!) 1.Services下添加box->boxService: 2.在Apps下添加BajaScriptTutorialsApp: 3.登录用户的Web Profil ...
- 【转】cocos2d-x windows开发环境配置
声明:本教程在参考了以下博文,并经过自己的摸索后实际操作得出,本教程系本人原创,由于升级后的cocos2d-x有了一些变化,目前的博文还没有关于Cocos2d-x 2.2.1最新版搭建Android交 ...
- Python学习笔记四,dict和set
dict是字典dictionary的缩写,他存放的是键值对key/value,用花括号表示,格式为d={'micheal':99,'jack':88} 当我们访问的时候直接print(d['miche ...
- 关于onclick中的event对象和element对象
event.srcElement:引发事件的目标对象,常用于onclick事件. event.fromElement:引发事件的对象源,常用于onmouseout和onmouseover事件. eve ...
- poj 1129 Channel Allocation
http://poj.org/problem?id=1129 import java.util.*; import java.math.*; public class Main { public st ...
- C# Url编码 HtmlUrl编码
今天看了Artwl的一片关于编码的文章,感觉写的非常好,而且人家那博客园的样式都比哥的好看得多,一幕了然,尤其是那黑色背景的H1,妈个B了,哥太喜欢了.既然如果,就来就着它的文章跟样式,顺便来总结一下 ...
- BufferedStream类 - 缓冲流
BufferedStream常用于对其他流的一个封装,它必须和其他流结合一起使用.MemoryStream将所有的内容都放入内存中,而BufferedStream不是.BufferedStream在基 ...
- undefined reference to `png_set_longjmp_fn'
这个是在Linux上编译项目的时候,一个动态库层用到的一个函数实现未找到,即使我链接了libpng2也没有找到,原因是这个库老了一些,没有这个函数定义,需要链接更高版本的png库,CentOS上有了在 ...