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)初始化,将所有节点的父亲节点都设置为自己 ...
随机推荐
- oracle生成随机数
UPDATE busi_chance_info t SET t.exp_amount = (SELECT floor(dbms_random.value(1, 10000000)) ...
- JavaScript---while和do while的区别
JavaScript,while 和do while的区别: 场景一:小盒子身上有100元,用while输出能吃多少次米线,一碗米线12元,最终还剩下多少钱. var money = 100; whi ...
- java之package与import
我就以package与import开始吧. package的作用其实就是c++的namespace的作用,防止名字相同的类产生冲突,只是实现的机制不一样,java编译器在编译时,直接根据package ...
- Intel Core i7的整体操作
Intel Core i7的整体操作(我们也称呼为Nehalem,他的项目代码名) 主要分成2个部分-指令控制单元Instruction Control Unit(ICU),负责从存储器读出指令序列, ...
- poj1200Crazy Search (哈希)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Crazy Search Time Limit: 1000MS Memory ...
- Mac OS X和iOS上基本数据类型的字节数
在Mac和IPhone上分别运行下面的程序: NSLog(@"char size = %lu", sizeof(char)); NSLog(@"short int siz ...
- 关于char/varchar(n)中n的探究:字符数or字节数
[问题来源]将设计的数据库表展示的时候,yu哥问我,你的那个top_info字段定义的类型是varchar(100),为什么是100呢,这100的长度能存多少个中文? 当时的想法就是,这个100能存多 ...
- 清空DNS缓存
昨天写了个Python的脚本,功能就是爬取一个网页上的Google ip地址再写入到本机的hosts里面去. 但是写完并且运行完成之后发现上不了Google.于是想到了是不是要清空一下DNS的缓存.不 ...
- abiword Namespace List
abiword Namespace List Here is a list of all namespaces with brief descriptions: abicollab 这个命名空间以及 ...
- javascript string对象的属性与方法
一 创建string对象 new string('string'); 更直接的定义方法是var str = 'string'; 二 string属性 1.constructor 2.lenght 字符 ...