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)初始化,将所有节点的父亲节点都设置为自己 ...
随机推荐
- int.TryParse 与 int.Parse 的区别
int.TryParse 与 int.Parse 的区别是,int.TryParse不会产生异常,转换成功返回 true,转换失败返回 false.最后一个参数为输出值,如果转换失败,输出值为 0. ...
- 安装ubuntu14.10系统的那些瞎折腾
前段时间自作孽,安装了ubuntu14.04的64位系统,而我的笔记本又是那种老古董,2G的内存所以装好之后各种不稳定,索性这个周末就重装一下吧,本来打算是直接装我以前的那个ubuntu12.04-i ...
- (原+译)win7远程连接ubuntu16.04
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5711214.html 原始网址: http://ubuntuhandbook.org/index.ph ...
- 通过startup启动tomcat一闪而过的问题
下载了免安装版的tomcat7,在通过startup.bat启动时,控制台一闪而过.记事本讲startup.bat打开,在最后一行加上pause,然后重新双击startup.bat,发现控制台打印的错 ...
- Object-c学习之路十(NSNumber&NSValue)
// // main.m // NSNumberAndNSValue // // Created by WildCat on 13-7-26. // Copyright (c) 2013年 wildc ...
- user密码
一.修改密码 alter user hr identified by hr; password/passw hr: SYS@test>password hr Changing password ...
- jQuery对checkbox的各种操作
//注意: 操作checkbox的checked,disabled属性时jquery1.6以前版本用attr,1.6以上(包含)建议用prop //1.根据id获取checkbox $("# ...
- Android 开发转型前端准备知识
最近React Native甚是流行,再加上微信推动微应用的背景下,Android和IOS向前端转型势在必行. 技能点: 1.lambda表达式 http://blog.csdn.net/ioriog ...
- 用php逐行读取文件
做个备份年纪大了,都不愿意自己思考了 $str = file_get_contents($tmpfilename);//获得内容 $arr = explode("\n",$str) ...
- Linux下安装Perl和Perl的DBI模块
今天在虚拟机测试shell脚本的时候,有些命令使用不了. 比如说 mysqlhotcopy ,它提示Perl的版本太低. 我用的 RedHat9 的Perl才5.8.0版本...(2002年以前的) ...