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

HDU 5365

时间:2015-08-15 20:07:57      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:acm算法

Run

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 989    Accepted Submission(s): 431


Problem Description

AFA is a girl who like runing.Today,he download an app about runing .The app can record the trace of her runing.AFA will start runing in the park.There are many chairs in the park,and AFA will start his runing in a chair and end in this chair.Between two chairs,she running in a line.she want the the trace can be a regular triangle or a square or a regular pentagon or a regular hexagon.
Please tell her how many ways can her find.
Two ways are same if the set of chair that they contains are same.

 


Input

There are multiply case.
In each case,there is a integer n(1 < = n < = 20)in a line.
In next n lines,there are two integers xi,yi(0 < = xi,yi < 9) in each line.

 


Output

Output the number of ways.

 


Sample Input

4
0 0
0 1
1 0
1 1

 


Sample Output

1

 


Source

BestCoder Round #50 (div.2)

 


Recommend

hujie   |   We have carefully selected several similar problems for you:  5390 5389 5388 5387 5386 

 




水一发,枚举四重for
#include <cstdio>
#include <cmath>
#include <queue>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
int a[10];
int distance1(int x,int y)
{
    return x*x+y*y;
}
int main()
{
    int n;
    int x,y;
    while(cin>>n)
    {
        int i,j,k,l;
        int x[21];
        int y[21];
        int res=0;
        memset(a,0,sizeof(a));
        for(i=0; i<n; i++)
            cin>>x[i]>>y[i];
        for(i=0; i<n; i++)
            for(j=i+1; j<n; j++)
                for(k=j+1; k<n; k++)
                    for(l=k+1; l<n; l++)
                    {
                        a[0]=distance1(x[i]-x[j],y[i]-y[j]);
                        a[1]=distance1(x[i]-x[k],y[i]-y[k]);
                        a[2]=distance1(x[i]-x[l],y[i]-y[l]);
                        a[3]=distance1(x[j]-x[k],y[j]-y[k]);
                        a[4]=distance1(x[j]-x[l],y[j]-y[l]);
                        a[5]=distance1(x[k]-x[l],y[k]-y[l]);
                        sort(a,a+6);
                        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]&&a[4]==a[5])
                            res++;
                    }
        cout<<res<<endl;
    }
}




版权声明:本文为博主原创文章,未经博主允许不得转载。

HDU 5365

标签:acm算法

原文地址:http://blog.csdn.net/sky_miange/article/details/47684255

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