hdu 1073 字符串处理
题意:给一系列的输出和标准答案,比较二者是AC,PE或WA
字符串处理还是比较薄弱,目前没什么时间搞字符串专题,所以遇到一题就努力搞懂
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
const double eps=1e-;
#define cl(a) memset(a,0,sizeof(a))
#define ts printf("*****\n");
const int MAXN=;
char a1[MAXN],a2[MAXN],b1[MAXN],b2[MAXN];
int n,m,tt;
char temp[MAXN];
void in(char a[],char b[])
{
gets(temp);
while(strcmp(temp,"START")!=) gets(temp); //START之前的都去掉
while(gets(temp))
{
if(strcmp(temp,"END")==) break;
if(strlen(temp)!=) strcat(a,temp); //读入的不为换行符
strcat(a,"\n");
}
int t=;
for(int i=;i<strlen(a);i++)
{
if(a[i]!=' '&&a[i]!='\n'&&a[i]!='\t') //\t要加,因为题目中有要求,汗
{
b[t++]=a[i];
}
}
b[t]='\0'; //注意这个一定要加,否则没办法比较
}
int main()
{
int i,j,k;
#ifndef ONLINE_JUDGE
freopen("1.in","r",stdin);
#endif
scanf("%d",&tt);
while(tt--)
{
a1[]='\0';
a2[]='\0';
in(a1,b1);
in(a2,b2);
if(strcmp(a1,a2)==) printf("Accepted\n"); //未被删除格式前都相同,说明完全相同
else if(strcmp(b1,b2)==) printf("Presentation Error\n");
else printf("Wrong Answer\n");
}
}
hdu 1073 字符串处理的更多相关文章
- 单词数 HDU 2072 字符串输入控制
单词数 HDU 2072 字符串输入控制 题意 lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数.下面你的任务是帮助xiaoou333解决这个 ...
- 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 1073
http://acm.hdu.edu.cn/showproblem.php?pid=1073 模拟oj判题 随便搞,开始字符串读入的细节地方没处理好,wa了好久 #include <iostre ...
- 解题报告:hdu 1073 Online Judge
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1073 Problem Description Ignatius is building an Onli ...
- hdu 4821 字符串hash+map判重 String (长春市赛区I题)
http://acm.hdu.edu.cn/showproblem.php?pid=4821 昨晚卡了非常久,開始TLE,然后优化了之后,由于几个地方变量写混.一直狂WA.搞得我昨晚都失眠了,,. 这 ...
- hdu 1880 字符串hash
/*普通的hsah 由于元素太多 空间很小..hash碰撞很厉害.30分*/ #include<iostream> #include<cstdio> #include<c ...
- HDU 1880 字符串hash 入门题
Problem Description 哈利波特在魔法学校的必修课之一就是学习魔咒.据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔 ...
随机推荐
- bzoj千题计划179:bzoj1237: [SCOI2008]配对
http://www.lydsy.com/JudgeOnline/problem.php?id=1237 如果没有相同的数不能配对的限制 那就是排好序后 Σ abs(ai-bi) 相同的数不能配对 交 ...
- Sublime Text 2 绿化与汉化 [Windows篇]
其实 ST3 已经出了很久了,可是我这个人恋旧,一直钟爱 ST2,所以就选择她了.最近我的 ST2 越来越卡,甚至有时候输入都会延迟1秒,所以打算自己搞个绿化版. 打开 Sublime Text 官网 ...
- [转载]JavaScript 的轻框架开发
http://www.open-open.com/news/view/1d64fed 为什么我们不用 Angular, Ember 或者 Backbone! Muut 是一个特殊的论坛平台,它也有着巨 ...
- [整理]Visual Studio 的Application Insights
简单介绍 Application Insights(预览版) Visual Studio 的Application Insights插件简介 Application Insights for Visu ...
- html之div始终停留在屏幕中间部分
需求: 使得某一个div始终停留在屏幕中间 实现: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
- shell 判断文件出现次数
判断 file 文件中 第一个变量 出现次数 awk '{print $1}' file |sort |uniq -c|sort -k1r
- mac rsync文件传输
rsync -avz filename servername:/filename --exclude '*.log' --exclude '*.pyc' --exclude '*.db' --excl ...
- .net的锁
一.lock .Monitor 处理并行任务的时候,效率最高的就是多线程.当不同线程需要访问同一资源时候,就需要同步了.就像生活中很多人要一起赶飞机大家都要访问飞机这个资源每个人是一条线程那么就有门 ...
- js input输入框的总结
一.输入框只能输入数字 原文:https://www.cnblogs.com/sese/p/5872144.html 分享下js限制输入框中只能输入数字的方法,包括整数与小数,分享几个例子,有需要的朋 ...
- Linux配置Selenium+Chrome+Java实现自动化测试
1.安装chrome sudo apt-get install libxss1 libappindicator1 libindicator7 wget https://dl.google.com/li ...