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: ...
随机推荐
- 20155226 mini DC 课堂测试补交
由于电脑突然出了点问题,我没有完成mini DC这个测试,现将测试内容及结果补交 题目如下 提交测试截图和码云练习项目链接,实现Linux下dc的功能,计算后缀表达式的值 代码如下 MyDC.clas ...
- 学号20155311 2016-2017-2 《Java程序设计》第6周学习总结
学号20155311 2016-2017-2 <Java程序设计>第6周学习总结 教材学习内容总结 第十章 输入/输出 10.1 InputStream与OutputStream Inpu ...
- 20155318 《Java程序设计》实验五 (网络编程与安全)实验报告
20155318 <Java程序设计>实验五 (网络编程与安全)实验报告 实验内容 了解计算机网络基础 掌握Java Socket编程 理解混合密码系统 掌握Java 密码技术相关API的 ...
- 【转载】OGRE 2.1 Windows 编译
OGRE 2.1 Windows 编译 环境: Windows 7 64Bit Visual Studio 2012 OGRE 2.1 CMake 2.8.12.1 OGRE: OGRE官方推出了最新 ...
- 【转载】DXUT进阶
原文:DXUT进阶 概要 这个指南涵盖了更多DXUT的高级应用. 这个指南里的大部分功能是可选的, 为了以最小的代价来增强你的应用程序. DXUT提供了一个简单的基于GUI系统的精灵和一个设备设置对话 ...
- day9 匿名函数 lambda
1. list列表排序 #### sort排序 nums = [,,,,,] nums.sort() print(nums) ### 结果 [, , , , , ] ######## 逆序 In [] ...
- Mybaits: MyBaits的xml文件中大于号和小于号的转义
< 小于号 < > 大于号 & & 和 & ' 单引号 ' " 双引号 "
- springboot对security的后端配置
一.Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架.它提供了一组可以在Spring应用上下文中配置的Bean,充分利用了Spring ...
- idea alt+enter导包时被锁定导某一个包时的解决方法
在只有一个包指向的时候,把光标放在Test这种字符之间的话 就会直接导这个 所以把光标放在最后就可以导别的了
- Hibernate各种主键生成策略与配置详解(转)
原文链接:http://www.cnblogs.com/hoobey/p/5508992.html 1.assigned 主键由外部程序负责生成,在 save() 之前必须指定一个.Hibernate ...