UVA11734_Big Number of Teams will Solve This
题意很简单,本身也是个水题。
给你两个字符串,如果两个串完全相同,那么输出yes;如果两串只是空格的不同,出去空格后完全相同,那么输出Output Format Error,否则输出Wrong Answer。
很简单,在两个数组上面各设置一个指针逐个比对向后移动,同时设置两个flag分别标记有无不相同的字符或者空格就ok了。
#include <iostream>
#include <cstdio>
#include <cstring>
#define maxn 1000100
using namespace std; char s1[maxn],s2[maxn];
int n,m,t,x1,x2,T;
bool flag1,flag2; void compare()
{
x1=x2=;
if (strlen(s1)!=strlen(s2)) flag2=false;
while (s1[x1] && s2[x2])
{
if (s1[x1]==s2[x2]) x1++,x2++;
else
{
if (s1[x1]==' ') x1++;
else if (s2[x2]==' ') x2++;
else
{
flag1=false;
return;
}
}
}
if (!s1[x1] && !s2[x2]) return;
if (s1[x1])
{
for (int i=x1; s1[i]; i++)
if (s1[i]!=' ')
{
flag1=false;
return;
}
}
for (int i=x2; s2[i]; i++)
if (s2[i]!=' ')
{
flag1=false;
return;
}
} int main()
{
scanf("%d",&T);gets(s1);
for (int i=; i<=T; i++)
{
flag2=flag1=true;
gets(s1);gets(s2);
compare();
printf("Case %d: ",i);
if (!flag1) puts("Wrong Answer");
else if (!flag2) puts("Output Format Error");
else puts("Yes");
}
return ;
}
UVA11734_Big Number of Teams will Solve This的更多相关文章
- UVA 11734 Big Number of Teams will Solve This
大水题,不解释啦! #include<cstdio> #include<cstring> #define maxn 50 using namespace std; char s ...
- Zerojudge解题经验交流
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...
- Gym 100952E&&2015 HIAST Collegiate Programming Contest E. Arrange Teams【DFS+剪枝】
E. Arrange Teams time limit per test:2 seconds memory limit per test:64 megabytes input:standard inp ...
- Rnadom Teams
Rnadom Teams 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.actioncid=88890#problem/B 题目: Descript ...
- CF478 B. Random Teams 组合数学 简单题
n participants of the competition were split into m teams in some manner so that each team has at le ...
- cf478B Random Teams
B. Random Teams time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- codeforces 478B Random Teams
codeforces 478B Random Teams 解题报告 题目链接:cm.hust.edu.cn/vjudge/contest/view.action?cid=88890#probl ...
- Random Teams
n participants of the competition were split into m teams in some manner so that each team has at le ...
- single number i && ii && iii
Problem statement Elementary knowledge: There is a popular question when I seeked my job at Beijing: ...
随机推荐
- 学号 2016-2017-20155329《Java程序设计》课程总结
学号 2016-2017-20155329<Java程序设计>课程总结 (按顺序)每周作业链接汇总 预备作业1:想象中的师生关系 预备作业2:C语言水平调查以及认为自己最强的一项技能和毕业 ...
- 【整理总结】代码沉淀 - Caliburn.Micro - MV*模式短小精悍的框架
Caliburn.Micro - Xaml made easy. web: https://github.com/Caliburn-Micro/Caliburn.Microdocument: http ...
- 二、Django用户认证之cookie和session
1.cookie原理 Cookie意为“甜饼”,是由W3C组织提出,最早由Netscape社区发展的一种机制.目前Cookie已经成为标准,所有的主流浏览器如IE.Netscape.Firefox.O ...
- 问题:python2.7 安装包失败,提示错误:Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)
问题描述: 使用pip安装包时报错,error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat) 环境: pyt ...
- 180723-Quick-Task 动态脚本支持框架之结构设计篇
文章链接:https://liuyueyi.github.io/hexblog/2018/07/23/180723-Quick-Task-动态脚本支持框架之结构设计篇/ Quick-Task 动态脚本 ...
- Django-建立网页
进入cmd模式做 django-admin startproject helloworld创建一个project,并命名helloworld,新生成的文件结构如下 输入python manage. ...
- nexus实现从windows迁移至Linux平台
说明: 由于老环境是在本地windows 2008 R2里面搭建的nexus,前面搭建了jenkins,需要将maven私库迁移至云服务器的CentOS 7系统下,之前没做过nexus的迁移,在网上看 ...
- SICP读书笔记 1.2
SICP CONCLUSION 让我们举起杯,祝福那些将他们的思想镶嵌在重重括号之间的Lisp程序员 ! 祝我能够突破层层代码,找到住在里计算机的神灵! 目录 1. 构造过程抽象 2. 构造数据抽象 ...
- Linux环境下Java应用性能分析定位-CPU使用篇
1 CPU热点分析定位背景 CPU资源还是很昂贵的,为了深刻感受到这种昂贵,间下图当前CPU的资源售价: 所以对于程序猿们来说,需要让程序合理高效的使用CPU资源.利用有限的CPU资源来解决完 ...
- Spring Task中的定时任务无法注入service的解决办法
1.问题 因一个项目(使用的是Spring+SpringMVC+hibernate框架)需要在spring task定时任务中调用数据库操作,在使用 @Autowired注入service时后台报错, ...