CF71C.Round Table Knights
普及/提高-
通过率:0%
时间限制:0.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in a good mood should be located. Otherwise, the next month will bring misfortunes.
A convex polygon is regular if all its sides have same length and all his angles are equal. In this problem we consider only regular polygons with at least 3 vertices, i. e. only nondegenerated.
On a picture below some examples of such polygons are present. Green points mean knights in a good mood. Red points mean ones in a bad mood.

King Arthur knows the knights' moods. Help him find out if the next month will be fortunate or not.
有 n 位骑士等间距地围坐在圆桌旁。每位骑士的情绪要么是“好”,要么是“坏”。
巫师梅林向亚瑟王预言:若能找出一个正多边形,使得该正多边形的所有顶点上都坐着情绪“好”的骑士,则下个月将格外幸运;否则,下个月将遭遇不幸。
凸多边形称为正多边形,当且仅当其所有边长度相等且所有内角相等。本题中,我们仅考虑至少具有 3 个顶点的正多边形,即仅考虑非退化情形。
下图给出了一些此类正多边形的示例。绿色点表示情绪“好”的骑士,红色点表示情绪“坏”的骑士。

亚瑟王已知晓各位骑士的情绪状态。请帮助他判断下个月是否将幸运。
输入格式
The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood.
第一行包含一个整数 n,表示圆桌旁骑士的数量(3≤n≤105)。第二行包含 n 个用空格分隔的数字,表示所有 n 位骑士按绕桌顺序的情绪状态。“1” 表示该骑士心情愉快,“0” 表示该骑士心情不佳。
输出格式
Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO".
如果下个月将是幸运月,则输出不带引号的 "YES";否则,输出 "NO"。
输入输出样例
输入#1
3 1 1 1
输出#1
YES
输入#2
6 1 0 1 1 1 0
输出#2
YES
输入#3
6 1 0 0 1 0 1
输出#3
NO
输入解题思路,AI测评打分。不知道怎么写?