当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6897:Reports

题目描述
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.
输入解释
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 $a_1,a_2,a_3,\cdots,a_n$, $a_i$ denotes the type of the $i$-th report. $a_i=0$ denotes a leaving school report and $a_i=1$ denotes an entering school report.

$1\leq T\leq 100$

$3\leq n\leq 50$

$0\leq a_i\leq 1$
输出解释
For every test case, output ``YES'' if Kanade's reports are correct, otherwise output ``NO'' (without quotes)
输入样例
4
3
1 1 1
3
1 0 1
5
0 1 0 1 0
4
1 0 1 1
输出样例
NO
YES
YES
NO
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6897

最后修改于 2020-10-25T23:35:22+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 524288/524288K(Java/Others)