您的位置:首页 > 其它

HDU 5365

2015-08-09 20:39 399 查看
Run

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 672 Accepted Submission(s): 293

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

//求多少个正方形

#include <stdio.h>
#include <algorithm>
using namespace std;

int x[100];
int y[100];
int a[10];

int dist(int x,int y,int x1,int y1)
{
return (x-x1)*(x-x1)+(y-y1)*(y-y1);
}

int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
{
scanf("%d%d",&x[i],&y[i]);
}
int res=0;
for(int i=0;i<n;i++)
{
for(int k=i+1;k<n;k++)
{
for(int j=k+1;j<n;j++)
{
for(int m=j+1;m<n;m++)
{
if(i!=k&&i!=j&&i!=m&&k!=j&&j!=m&&k!=m)
{
int cnt,flag;
cnt=flag=0;
a[0]=dist(x[i],y[i],x[k],y[k]);
a[1]=dist(x[i],y[i],x[j],y[j]);
a[2]=dist(x[i],y[i],x[m],y[m]);
a[3]=dist(x[k],y[k],x[j],y[j]);
a[4]=dist(x[k],y[k],x[m],y[m]);
a[5]=dist(x[j],y[j],x[m],y[m]);
sort(a,a+6);
// for(int q=0;q<6;q++)
// printf("%d ",a[q]);
//   printf("\n");
for(int p=1;p<6;p++)
{
if(a[p]!=a[p-1])
{
cnt++;
if(a[p]/a[p-1]==2)
flag=1;
}
}
if(cnt==1&&flag==1)
res++;
//  printf("%d\n",res);
}
}
}
}
}
printf("%d\n",res);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: