码迷,mamicode.com
首页 > 其他好文 > 详细

BZOJ 1800: [Ahoi2009]fly 飞行棋

时间:2017-09-21 19:37:48      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:zoj   int   geo   .com   com   pre   gis   logs   problem   

二次联通门 : BZOJ 1800: [Ahoi2009]fly 飞行棋

 

 

 

 

/*
    BZOJ 1800: [Ahoi2009]fly 飞行棋

    乱搞一下就好
*/
#include <cstdio>
#include <iostream>
#define rg register
inline void read (int &n)
{
    rg int c = getchar ();
    for (n = 0; !isdigit (c); c = getchar ());
    for (; isdigit (c); n = n * 10 + c - 0, c = getchar ());
}
#define Max 1000001
int c[Max]; bool is[Max];
int main (int argc, char *argv[])
{
    int N, x, s = 0, Answer = 0; rg int i, j; read (N);
    for (i = 1; i <= N; ++ i) 
        read (x), is[s] = true, c[i] = s, s += x;
    for (i = 1; i <= N; ++ i)
        for (j = i + 1; j <= N; ++ j) 
            if (is[c[j] + (s - 2 * (c[j] - c[i])) / 2] && is[c[j] + (s - 2 * (c[j] - c[i])) / 2 + c[j] - c[i]]) ++ Answer;
    printf ("%d", Answer); return 0;
}

 

BZOJ 1800: [Ahoi2009]fly 飞行棋

标签:zoj   int   geo   .com   com   pre   gis   logs   problem   

原文地址:http://www.cnblogs.com/ZlycerQan/p/7569996.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!