HDU 1073
http://acm.hdu.edu.cn/showproblem.php?pid=1073
模拟oj判题
随便搞,开始字符串读入的细节地方没处理好,wa了好久
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std ;
char s1[],s2[] ;
char s3[],s4[] ;
int main()
{
int t ;
scanf("%d%*c",&t) ;
while(t--)
{
scanf("%*s%*c") ;
char ch ;
int st= ;
while(ch=getchar())
{
s1[st++]=ch ;
if(ch=='\n' && st> && s1[st-]=='E' && s1[st-]=='N' && s1[st-]=='D')
break ;
}
s1[st-]='\0' ;
scanf("%*s%*c") ;
st= ;
while(ch=getchar())
{
s2[st++]=ch ;
if(ch=='\n' && st> && s2[st-]=='E' && s2[st-]=='N' && s2[st-]=='D')
break ;
}
s2[st-]='\0' ;
if(!strcmp(s1,s2))
{
puts("Accepted") ;
}
else
{
st= ;
for(int i= ;i<strlen(s1) ;i++)
if(s1[i]==' ' || s1[i]=='\t' || s1[i]=='\n')
continue ;
else
s3[st++]=s1[i] ;
s3[st]='\0' ;
st= ;
for(int i= ;i<strlen(s2) ;i++)
if(s2[i]==' ' || s2[i]=='\t' || s2[i]=='\n')
continue ;
else
s4[st++]=s2[i] ;
s4[st]='\0' ;
if(!strcmp(s3,s4))
puts("Presentation Error") ;
else
puts("Wrong Answer") ;
}
}
return ;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std ;
char s1[],s2[] ;
int main()
{
int t ;
scanf("%d%*c",&t) ;
while(t--)
{
scanf("%*s%*c") ;
char ch ;
int st= ;
while(ch=getchar())
{
s1[st++]=ch ;
if(ch=='\n' && st> && s1[st-]=='E' && s1[st-]=='N' && s1[st-]=='D')
break ;
}
s1[st-]='\0' ;
scanf("%*s%*c") ;
st= ;
while(ch=getchar())
{
s2[st++]=ch ;
if(ch=='\n' && st> && s2[st-]=='E' && s2[st-]=='N' && s2[st-]=='D')
break ;
}
s2[st-]='\0' ;
if(!strcmp(s1,s2))
{
puts("Accepted") ;
}
else
{
map <char,int> M1,M2 ;
for(int i= ;i<strlen(s1) ;i++)
M1[s1[i]]++ ;
for(int i= ;i<strlen(s2) ;i++)
M2[s2[i]]++ ;
map <char,int> :: iterator it ;
int f= ;
for(it=M1.begin() ;it!=M1.end() ;it++)
if(M2[it->first]!=it->second && it->first!=' ' && it->first!='\t' && it->first!='\n')
{
f= ;
break ;
}
if(f)
puts("Presentation Error") ;
else
puts("Wrong Answer") ;
}
}
return ;
}
HDU 1073的更多相关文章
- 解题报告: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
模拟评测机判断答案 先判断有没有不一样的 有的话再提取出 有效子列 看看有没有错的 #include <iostream> #include <cstdio> #include ...
- hdu 1073 字符串处理
题意:给一系列的输出和标准答案,比较二者是AC,PE或WA 字符串处理还是比较薄弱,目前没什么时间搞字符串专题,所以遇到一题就努力搞懂 #include<cstdio> #include& ...
- 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——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
随机推荐
- Hive查询Join
Select a.val,b.val From a [Left|Right|Full Outer] Join b On (a.key==b.key); 现有两张表:sales 列出了人名及其所购商品的 ...
- Mysql批量更新速度慢的解决方案
批量更新的时候不能用子查询 where shop_orderform_id in( select shop_orderform_id from `shop_orderform` where user_ ...
- pyspider—爬取下载图片
以第一ppt网站为例:http://www.1ppt.com/ from pyspider.libs.base_handler import * import urllib2,HTMLParser,r ...
- awk字符串处理
awk 字符串处理函数 awk提供了许多强大的字符串函数,见下表:awk内置字符串函数gsub(r,s) 在整个$0中用s替代rgsub(r,s,t) 在整个t中用s替代rindex(s, ...
- HttpServletResponse response详解
//内容类型和编码格式可以被调用多次,最后一次将覆盖之前的设置 //内容类型和编码格式必须在 //设置内容类型getWriter和getOutputStream方法之前调用,否则不起作用 //若未设置 ...
- RabbitMQ 之 订阅模式 Publish/Subscribe
模型图 我们之前学习的都是一个消息只能被一个消费者消费,那么如果我想发一个消息 能被多个消费者消费,这时候怎么办? 这时候我们就得用到了消息中的发布订阅模型 在前面的教程中,我们创建了一个工作队列,都 ...
- tensorflow wide deep 介绍
https://blog.csdn.net/heyc861221/article/details/80131369 https://blog.csdn.net/heyc861221/article/d ...
- javascript中对变量类型的判断
本文正式地址:http://www.xiabingbao.com/javascript/2015/07/04/javascript-type 在JavaScript中,有5种基本数据类型和1种复杂数据 ...
- 数据库建表char(10)和VARCHAR(10)
1.CHAR的长度是固定的,而VARCHAR2的长度是可以变化的, 比如,存储字符串“abc",对于CHAR (10),表示你存储的字符将占10个字节(包括7个空字符),而同样的VARCHA ...
- 修改tomcat默认端口号8080
1.背景 在默认情况下,tomcat的端口是8080,使用了两个tomcat,那么就需要修改其中的一个的端口号才能使得两个同时工作. 2.方法 2.1改动一 那么,如何修改tomcat的端口号呢?首先 ...