外星智能AI (CI翻译)
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*$ 天中的每一天,如果当天收到了信号,Vasya 就在笔记本上写下 1;否则写下 0。Vasya 认为,如果信号的接收方式存在某种规律,也就是连续信号之间的所有间隔都相等,那么他就找到了外星智能。否则,Vasya 认为这些信号是由一些无聊的外星人发送的,没人会在意。请根据接收器提供的信息,帮助 Vasya 判断他是否找到了外星智能。AI (CI翻译)Input
输入格式
AI (CI翻译)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。AI (CI翻译)
Output
输出格式
AI (CI翻译)If Vasya has found extra-terrestrial intelligence, output YES, otherwise output NO.
如果 Vasya 找到了外星智能,输出 YES;否则输出 NO。
AI (CI翻译)
样例
8
00111000
YES
7
1001011
NO
7
1010100
YES
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。