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

bzoj千题计划174:bzoj1800: [Ahoi2009]fly 飞行棋

时间:2017-12-31 11:55:32      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:input   images   online   class   problem   inpu   geo   print   scan   

http://www.lydsy.com/JudgeOnline/problem.php?id=1800

 

圆上两条直径构成矩形的对角线

 

#include<cstdio>

using namespace std;

int sum[21];

int main()
{
    int n;
    scanf("%d",&n);
    int x,tot=0;
    for(int i=1;i<=n;++i) scanf("%d",&sum[i]),tot+=sum[i];
    for(int i=2;i<=n;++i) sum[i]+=sum[i-1];
    int cnt=0;
    tot>>=1;
    for(int i=1;i<n;++i)    
        for(int j=i+1;j<=n;++j)
            if(sum[j]-sum[i]==tot) cnt++;
    printf("%d",cnt*(cnt-1)/2);
}

 

1800: [Ahoi2009]fly 飞行棋

Time Limit: 10 Sec  Memory Limit: 64 MB
Submit: 1888  Solved: 1476
[Submit][Status][Discuss]

Description

给出圆周上的若干个点,已知点与点之间的弧长,其值均为正整数,并依圆周顺序排列。 请找出这些点中有没有可以围成矩形的,并希望在最短时间内找出所有不重复矩形。

Input

第一行为正整数N,表示点的个数,接下来N行分别为这N个点所分割的各个圆弧长度

Output

所构成不重复矩形的个数

Sample Input

8
1
2
2
3
1
1
3
3


Sample Output

3

HINT

N<= 20
技术分享图片

bzoj千题计划174:bzoj1800: [Ahoi2009]fly 飞行棋

标签:input   images   online   class   problem   inpu   geo   print   scan   

原文地址:https://www.cnblogs.com/TheRoadToTheGold/p/8157173.html

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