题目链接

很多小的细节都没想到。。。

 #include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
int p[];
int o[];
int main()
{
int n,i,flag = ,j;
scanf("%d",&n);
for(i = ;i < n;i ++)
{
scanf("%d",&p[i]);
if(p[i] == )
flag = ;
}
if(flag)
{
printf("YES\n");
return ;
}
if(n% == &&n > )
{
memset(o,,sizeof(o));
for(i = ;i < n;i ++)
{
o[i%] += p[i];
}
if(o[] == n/||o[] == n/)
{
printf("YES\n");
return ;
}
}
for(i = ;i*i <= n;i ++)
{
if(n%i == )
{
int mod;
memset(o,,sizeof(o));
mod = n/i;
for(j = ;j < n;j ++)
{
o[j%mod] += p[j];
}
for(j = ;j < mod;j ++)
{
if(o[j] == i)
{
printf("YES\n");
return ;
}
}
memset(o,,sizeof(o));
mod = i;
for(j = ;j < n;j ++)
{
o[j%mod] += p[j];
}
for(j = ;j < mod;j ++)
{
if(o[j] == n/i)
{
printf("YES\n");
return ;
}
}
}
}
printf("NO\n");
return ;
}

CF 71C. Round Table Knights的更多相关文章

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

    http://codeforces.com/problemset/problem/71/C 题意: 在一个圆桌上有n个人,每个人要么是1,要么就是0,现在要判断是否能由一些1相连构成正多边形. 思路: ...

  2. POJ2942 Knights of the Round Table[点双连通分量|二分图染色|补图]

    Knights of the Round Table Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 12439   Acce ...

  3. POJ 2942 Knights of the Round Table

    Knights of the Round Table Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 10911   Acce ...

  4. poj 2942 Knights of the Round Table 圆桌骑士(双连通分量模板题)

    Knights of the Round Table Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 9169   Accep ...

  5. 【LA3523】 Knights of the Round Table (点双连通分量+染色问题?)

    Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress ...

  6. POJ 2942 Knights of the Round Table - from lanshui_Yang

    Description Being a knight is a very attractive career: searching for the Holy Grail, saving damsels ...

  7. UVALive - 3523 - Knights of the Round Table

    Problem  UVALive - 3523 - Knights of the Round Table Time Limit: 4500 mSec Problem Description Input ...

  8. poj 2942 Knights of the Round Table - Tarjan

    Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress ...

  9. 【POJ】2942 Knights of the Round Table(双连通分量)

    http://poj.org/problem?id=2942 各种逗.... 翻译白书上有:看了白书和网上的标程,学习了..orz. 双连通分量就是先找出割点,然后用个栈在找出割点前维护子树,最后如果 ...

随机推荐

  1. Linux(CentOS)常用操作指令(一)

    基本指令集合 1.查看CentOS版本信息 cat /proc/version cat /etc/redhat-release 2.查看安全日志文件信息 tail -f /var/log/secure ...

  2. Tiny Rss Reader - 迷你RSS阅读器

    发布新软件 TinyRss: Windows平台上的一个小巧的Rss阅读器. 用户界面: 项目地址: https://github.com/movsb/tinyrss.git 测试下载: http:/ ...

  3. dbca:Exception in thread "main" java.lang.UnsatisfiedLinkError: get

    在64位的操作系统安装oracle10g 软件安装完成后,使用dbca建库的时候报下面的错: $ dbcaUnsatisfiedLinkError exception loading native l ...

  4. revert merge会出现的问题

    比如当我们git revert的时候, git revert Git会抱怨: is a merge but no -m option was given 这是因为你revert的那个commit是一个 ...

  5. hp,Qlogic,Brocade光纖卡查看方式

    查看光纖卡類型 # lspci| grep Fibre 1. NHB棟 光纖卡brocade /sys/class/fc_host 查看光纖卡是否加載,若無,打驅動brocade_adapter_so ...

  6. Java Hour 67 Java Collection API

    本文不是一个大而全的讲述Java Coleection 相关的APi, 而是笔者认为哪些是一个初学者所能够而且必须确切知道的知识点. Collection 一脉 这里有我们比较常用的List<E ...

  7. WPF ListView展示层叠信息

    通常我们在ListView中展示一列同类数据,例如城市名称.不过可以对ListView的DataTemplate稍作修改,让其显示层叠信息.例如:需要在ListView中显示省份和省份对应的城市名称. ...

  8. HDU 4812 D Tree 树分治+逆元处理

    D Tree Problem Description   There is a skyscraping tree standing on the playground of Nanjing Unive ...

  9. 智能车学习(十四)——K60单片机GPIO学习

    一.头文件: #ifndef __MK60_GPIO_H__ #define __MK60_GPIO_H__ #include "MK60_gpio_cfg.h" /* * 定义管 ...

  10. ASP.NET MVC使用过滤器进行权限控制

    1.新建MVC项目 2.找到Models文件夹,新建 LoginCheckFilterAttribute 类 public class LoginCheckFilterAttribute : Acti ...