CF36A.Extra-terrestrial Intelligence
普及-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record of the signals for n days in a row. Each of those n days Vasya wrote a 1 in his notebook if he had received a signal that day and a 0 if he hadn’t. Vasya thinks that he has found extra-terrestrial intelligence if there is a system in the way the signals has been received, i.e. if all the intervals between successive signals are equal. Otherwise, Vasya thinks that the signals were sent by some stupid aliens no one cares about. Help Vasya to deduce from the information given by the receiver if he has found extra-terrestrial intelligence or not.
最近,瓦西娅对寻找地外文明产生了兴趣。他制作了一个简单的地外信号接收器,并连续记录了 n 天的信号接收情况。在这 n 天中,瓦西娅每天在笔记本上记下 1(表示当天接收到信号)或 0(表示当天未接收到信号)。瓦西娅认为自己发现了地外文明,当且仅当信号的接收方式呈现出某种规律性,即:所有相邻两次信号接收之间的时间间隔均相等。否则,瓦西娅认为这些信号是由一些无人关心的愚蠢外星人发出的。请根据接收器给出的信息,帮助瓦西娅判断他是否发现了地外文明。
输入格式
The first line contains integer n (3 ≤ n ≤ 100) — amount of days during which Vasya checked if there were any signals. The second line contains n characters 1 or 0 — the record Vasya kept each of those n days. It’s guaranteed that the given record sequence contains at least three 1s.
第一行包含一个整数 n(3≤n≤100)—— 表示 Vasya 检查是否存在信号的天数。
第二行包含 n 个字符,每个字符为 1 或 0 —— 表示 Vasya 在这 n 天中每天的记录。
保证给定的记录序列中至少包含三个 1。
输出格式
If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO.
如果瓦西娅发现了地外文明,则输出 YES,否则输出 NO。
输入输出样例
输入#1
8 00111000
输出#1
YES
输入#2
7 1001011
输出#2
NO
输入#3
7 1010100
输出#3
YES
输入解题思路,AI测评打分。不知道怎么写?