http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1010&cid=909

Reports

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 5634    Accepted Submission(s): 3476

Problem Description
Because of Covid-19, Kanade needs to report every time when entering and leaving school. Now you want to check if Kanade's reports on a certain day are correct.

A sequence of reports is correct if and only if there does not exist two consecutive and same reports.
 
Input
There are T test cases in this problem.

The first line has one integer T.

For every test case:

The first line has one integer n which denotes the number of times Kanade reported on a certain day.

The second line has n integers a1,a2,a3,⋯,an, ai denotes the type of the i-th report. ai=0 denotes a leaving school report and ai=1 denotes an entering school report.

1≤T≤100

3≤n≤50

0≤ai≤1
 
Output
For every test case, output ``YES'' if Kanade's reports are correct, otherwise output ``NO'' (without quotes)
 
Sample Input
4
3
1 1 1
3
1 0 1
5
0 1 0 1 0
4
1 0 1 1
 
Sample Output
NO
YES
YES
NO
 
题意:给定出入记录,检查是否合理
(不能在没有进的情况下出两次,同理进)
 
代码:
#include <iostream>
using namespace std; int main(){
int T;
ios::sync_with_stdio(false);
cin>>T;
while(T--){
int n,a[55]={0};
cin>>n;
bool flag=0;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=1;i<n;i++)
if(a[i]==a[i-1]){
cout<<"NO"<<endl;
flag=1;
break;
}
if(!flag) cout<<"YES"<<endl;
}
return 0;
}

  

1010 Reports的更多相关文章

  1. BZOJ 1010: [HNOI2008]玩具装箱toy [DP 斜率优化]

    1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 9812  Solved: 3978[Submit][St ...

  2. Entity Framework 6 Recipes 2nd Edition(10-10)译 - > 为TPH继承的插入、更新、删除操作映射到存储过程

    10-10. 为TPH继承的插入.更新.删除操作映射到存储过程 问题 TPH继承模型,想把它的插入.修改.删除操作映射到存储过程 Solution 假设数据库有一个描述不同种类的产品表(Product ...

  3. ERROR 1010 (HY000): Error dropping database (can't rmdir './test/', errno: 17)

    在删除数据库的时候报标题所示错误 mysql> drop database test; ERROR (HY000): Error dropping database (can't rmdir ' ...

  4. web报表工具Stimulsoft Reports.Web在mvc项目中使用

    Stimulsoft Reports.Web,是一款可以直接在Web中编辑报表的报表工具 web项目技术框架mvc4+easyui+knockoutjs 1.在项目中添加引用 Stimulsoft.B ...

  5. NetSuite Chinese Finance Reports

    NetSuite has a strong report customization application. The standard finance reports has a different ...

  6. Ural 1010. Discrete Function

    1010. Discrete Function Time limit: 1.0 secondMemory limit: 64 MB There is a discrete function. It i ...

  7. Download Free Oracle Reports Building Guide eBook

    A very nice ebook on building reports in Oracle fusion middleware 11g. This manual is intended for a ...

  8. HDU 1010 Tempter of the Bone(深度+剪枝)

    http://acm.hdu.edu.cn/showproblem.php?pid=1010 题意:就是给出了一个迷宫,小狗必须经过指定的步数到达出口,并且每个格子只能走一次. 首先先来介绍一下奇偶性 ...

  9. Crystal Reports拉报表报错:Error detected by database DLL

    问题描述: 最近在使用Crystal Reports打印报表时,提示错误信息:"Error detected by database DLL." 如下图: 经查找,是因为数据库名称 ...

  10. 水晶报表13.x(Crystal Reports for VS2010)的安装部署经验

    这两天搞安装包真心坎坷,一个问题接一个问题,先是为了实现自定义动作现啃vbs,后面又是安装过程老是报错: 各种搜索.各种尝试,总算搞掂,积累了些经验,分享一下. 首先CR for VS2010的所有东 ...

随机推荐

  1. wireshark 抓包查看包得明文消息

    转载注明出处: 最近在进行一些网络消息得定位,发现可以用wireshark查看网络包得消息内容,特此记录 需要注意得是,需要将wireshark更新到最新得版本,如果是老版本有可能不支持. 使用tcp ...

  2. Web前端入门第 62 问:JavaScript 循环结构注意事项

    HELLO,这里是大熊的前端开发笔记. 循环作为 算法与数据结构 中的基石,JS 与其他编程语言一样,都提供了多种循环结构用于处理数据. for 循环 事物的开端往往都是从最常用的开始,循环结构咱们从 ...

  3. SAP-EWM/ECC 系统后台配置(引用,备份)

    原文:https://blog.csdn.net/Daniel_kong198577/article/details/19615153 Unit1 – Basic Settings (default) ...

  4. 数栈UI5.0设计实战|B端表单这样设计,不仅美观还提效

    表单是B端产品中最常见的组件之一,主要⽤于数据收集.校验和提交.比如登陆流程的账号密码填写,注册流程的邮箱.用户名等信息填写,都是表单应用的常见案例,在数栈产品中也是出现频率⾮常⾼的组件. 尽管表单应 ...

  5. 杭州联合银行 x 袋鼠云:打造智能标签体系,助力银行大零售业务转型

    "智能标签平台上线后,支行及业务部门已创建多个客群用于营销,为我行客户精细化管理打下了良好基础." 杭州联合银行始终以服务市民.小微企业.经济组织和地方经济发展为己任,本着&quo ...

  6. 十一、buildroot系统登录配置

    4.6.系统登录 4.6.1.系统登录方式配置 1.系统初始化配置选择 配置路径 : → System configuration → Init system 配置参数说明: BusyBox 简介:B ...

  7. TreeMap实现类和SortMap接口

    注意:Map与Set集合的关系非常密切.java源码就是先实现了HashMap,TreeMap,再包装了一个value都为null的Map集合实现Set集合类. 因此:TreeSet可以和TreeMa ...

  8. Xamarin.Android 获取屏幕分辨率

    var metrics = Resources.DisplayMetrics;            Log.Debug("屏幕分辨率", $"宽={metrics.Wi ...

  9. 论文解读:MASS-EDITING MEMORY IN A TRANSFORMER(MEMIT)

      论文发表于人工智能顶会ICLR(原文链接).在模型编辑方法中,过去工作主要局限于更新单个事实.因此,基于ROME,本文开发了MEMIT,在大模型GPT-J(6B)和GPT-NeoX(20B)上实现 ...

  10. 用commitlint规范团队的git提交信息

    前言在一个团队中,每个人的git的commit信息都不一样,五花八门,没有一个机制很难保证规范化,如何才能规范化呢?可能你想到的是git的hook机制,去写shell脚本去实现.这当然可以,其实Jav ...