题意很简单,本身也是个水题。

给你两个字符串,如果两个串完全相同,那么输出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的更多相关文章

  1. UVA 11734 Big Number of Teams will Solve This

    大水题,不解释啦! #include<cstdio> #include<cstring> #define maxn 50 using namespace std; char s ...

  2. Zerojudge解题经验交流

    题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...

  3. 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 ...

  4. Rnadom Teams

    Rnadom  Teams 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.actioncid=88890#problem/B 题目: Descript ...

  5. CF478 B. Random Teams 组合数学 简单题

    n participants of the competition were split into m teams in some manner so that each team has at le ...

  6. cf478B Random Teams

    B. Random Teams time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  7. codeforces 478B Random Teams

    codeforces   478B  Random Teams  解题报告 题目链接:cm.hust.edu.cn/vjudge/contest/view.action?cid=88890#probl ...

  8. Random Teams

    n participants of the competition were split into m teams in some manner so that each team has at le ...

  9. single number i && ii && iii

    Problem statement Elementary knowledge: There is a popular question when I seeked my job at Beijing: ...

随机推荐

  1. 2017-2018-1 20155315 《信息安全系统设计基础》加分作业:实现mypwd

    学习pwd命令 man pwd查看 pwd命令用于显示当前工作目录,是Linux下最常用的命令之一.在不太确定当前位置时,就会使用pwd来判定当前目录在文件系统内的确切位置. 环境变量OLDPWD表示 ...

  2. 20155334 2016-2017-2 《Java程序设计》第二周学习总结

    20155334 2016-2017-2 <Java程序设计>第二周学习总结 教材学习内容总结 java中的基本类型 整数:有short.int.long三种 字节:byte 字符:cha ...

  3. 客户端与服务器端同步Evernote

    原文地址:http://www.zhihu.com/question/20238731 Evernote的同步方式是 以本地为基准同步到网络 还是 以网络为基准同步到本地 的? 若客户端从未与服务器端 ...

  4. 使用Photon引擎进行unity网络游戏开发(四)——Photon引擎实现网络游戏逻辑

    使用Photon引擎进行unity网络游戏开发(四)--Photon引擎实现网络游戏逻辑 Photon PUN Unity 网络游戏开发 网络游戏逻辑处理与MasterClient 网络游戏逻辑处理: ...

  5. 【python 3.6】使用itertools.product进行排列组合

    #python 3.6 #!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'BH8ANK' import itertools colo ...

  6. 《Cocos2d-x游戏开发实战精解》学习笔记2--在Cocos2d-x中显示一行文字

    在Cocos2d-x中要显示文字就需要用到Label控件.在3.x版本的Cocos2d中,舍弃了之前版本所使用的LabelTTF.LabelAtlas.LabelBMFont 3个用于显示文字的类,而 ...

  7. 算法笔记(c++)--桶排序题目

    算法笔记(c++)--桶排序 记得题目是排序,输入n个1-1000的数字然后去重然后排序. 桶排序没毛病 #include<iostream> using namespace std; i ...

  8. Method 'ExecuteAsync' in type 'System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy' does not have an implementation

    一.错误信息 Entity Framework 6.0数据迁移:Add-Migration XXXX 命令发生错误 System.Reflection.TargetInvocationExceptio ...

  9. spring-boot Jpa配置

    spring.jpa.hibernate.ddl-auto ddl-auto:create----每次运行该程序,没有表格会新建表格,表内有数据会清空 ddl-auto:create-drop---- ...

  10. AutoCAD2015激活码和密钥

    CAD2015序列号和密钥 序列号:    666-69696969     产品密钥:     001G1 序列号:    356-72378422     产品密钥:     206G1 安装说明 ...