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)初始化,将所有节点的父亲节点都设置为自己 ...
随机推荐
- mysql 数据库连接池
hibernate配置C3P0详解 分类: hibernate 2013-08-14 16:16 1213人阅读 评论 ...
- swift——设置navigationitemtitle的内容以及格颜色
1.用UILabel,自定义整个titleview // var TitleText = UILabel() self.TitleText.frame = CGRectMake(0, 0, 100, ...
- C# socket网络编程 基于TCP协议
socket 服务器端: 1.创建socket Socket tcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ...
- SPOJ 4206 Fast Maximum Matching (二分图最大匹配 Hopcroft-Carp 算法 模板)
题目大意: 有n1头公牛和n2头母牛,给出公母之间的m对配对关系,求最大匹配数.数据范围: 1 <= n1, n2 <= 50000, m <= 150000 算法讨论: 第一反应 ...
- 12个非常有用的JavaScript小技巧
在这篇文章中将给大家分享12个有关于JavaScript的小技巧.这些小技巧可能在你的实际工作中或许能帮助你解决一些问题. 使用!!操作符转换布尔值 有时候我们需要对一个变量查检其是否存在或者检查值是 ...
- SQL SERVER中如何格式化日期
1. SELECT convert(varchar, getdate(), 100) -- mon dd yyyy hh:mmAM (or PM) -- Oct 2 2008 11:01AM ...
- php sscanf() 函数使用
定义和用法 sscanf() 函数根据指定的格式解析来自一个字符串的输入. 如果只向该函数传递两个参数,数据将以数组的形式返回.否则,如果传递了额外的参数,那么被解析的数据会存储在这些参数中.如果区分 ...
- 居然因为交换错了好几把。。。。,还有坑点是num1可以大于num2
完数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- jQuery.data的是jQuery的数据缓存系统
jQuery.Data源码 jQuery.data的是jQuery的数据缓存系统 jQuery.data的是jQuery的数据缓存系统.它的主要作用就是为普通对象或者DOM元素添加数据. 1 内部存储 ...
- Mysql基础教程——mysql之一
教程列表:http://www.dxzy163.com/view/index7627.html 41 存储过程 40 全文索引与停止词 39 索引的管 38 索引概念 37 数据库备份与恢复 36 事 ...