• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            coreBugZJ

            此 blog 已棄。

            Round Table Knights,Codeforces Beta Round #65 (Div. 2) ,C

            C. Round Table Knights
            time limit per test
            3 seconds
            memory limit per test
            256 megabytes
            input
            standard input
            output
            standard output



            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.



            Input

            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.

            Output

            Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO".



            Sample test(s)
            Input
            3
            1 1 1
            Output
            YES

            Input
            6
            1 0 1 1 1 0
            Output
            YES

            Input
            6
            1 0 0 1 0 1
            Output
            NO



            水之。。。


             1 #include <iostream>
             2 #include <cstdio>
             3 
             4 using namespace std;
             5 
             6 #define  L  100009
             7 int n, a[ L ], s[ L ];
             8 
             9 int yes() {
            10         int i, j, m = n/3, k;
            11         for ( i = 1; i <= m; ++i ) {
            12                 if ( n % i == 0 ) {
            13                         for ( j = 1; j <= i; ++j ) {
            14                                 s[ j ] = a[ j ];
            15                         }
            16                         for ( j = i+1; j <= n; ++j ) {
            17                                 s[ j ] = s[ j - i ] + a[ j ];
            18                         }
            19                         k = n / i;
            20                         for ( j = n-i+1; j <= n; ++j ) {
            21                                 if ( s[ j ] == k ) {
            22                                         return 1;
            23                                 }
            24                         }
            25                 }
            26         }
            27         return 0;
            28 }
            29 
            30 int main() {
            31         int i;
            32         while ( scanf( "%d"&n ) == 1 ) {
            33                 for ( i = 1; i <= n; ++i ) {
            34                         scanf( "%d", a+i );
            35                 }
            36                 if ( yes() ) {
            37                         puts( "YES" );
            38                 }
            39                 else {
            40                         puts( "NO" );
            41                 }
            42         }
            43         return 0;
            44 }
            45 


            posted on 2011-03-31 20:43 coreBugZJ 閱讀(388) 評論(0)  編輯 收藏 引用 所屬分類: ACM

            中文成人久久久久影院免费观看| 浪潮AV色综合久久天堂| 久久人妻少妇嫩草AV蜜桃| 久久久久亚洲精品男人的天堂| 久久青青草原精品国产不卡 | 无码日韩人妻精品久久蜜桃| 久久久SS麻豆欧美国产日韩| 中文字幕日本人妻久久久免费| 亚洲va久久久噜噜噜久久男同 | 亚洲伊人久久大香线蕉苏妲己 | 一本色道久久综合狠狠躁| 99精品国产在热久久| 伊人久久大香线蕉AV一区二区| 欧美黑人激情性久久| 精品久久久久久无码中文字幕| 亚洲中文精品久久久久久不卡 | 久久99热只有频精品8| 久久久久久亚洲精品无码| 日韩精品久久久久久| 久久一日本道色综合久久| 性做久久久久久久久久久| 91久久九九无码成人网站| 亚洲αv久久久噜噜噜噜噜| 久久久精品久久久久影院| 国产精品嫩草影院久久| 久久91精品国产91久久麻豆| 熟妇人妻久久中文字幕| 日韩欧美亚洲综合久久| 一本色道久久88综合日韩精品 | 久久天堂AV综合合色蜜桃网| 2021国内精品久久久久久影院| 国产高清美女一级a毛片久久w | 久久亚洲高清观看| 99re久久精品国产首页2020| 久久精品国产亚洲AV嫖农村妇女| 伊人久久大香线焦AV综合影院 | 天天躁日日躁狠狠久久| 99久久夜色精品国产网站| 亚洲精品乱码久久久久久蜜桃图片| 超级碰碰碰碰97久久久久| 一本色道久久HEZYO无码|