hdu 5365 (bc #50 1002 )Run

Run

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


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
 
证明在这里: http://www.zhihu.com/question/25304120/answer/30445478
 
然后就暴力做就行,枚举四个点
正方形判断的条件是四条边相等且对角线相等,且对焦想的平方等于边长平方的2倍.
 1 /*************************************************************************
 2     > File Name: code/bc/#50/1002.cpp
 3     > Author: 111qqz
 4     > Email: rkz2013@126.com 
 5     > Created Time: 2015年08月08日 星期六 20时31分14秒
 6  ************************************************************************/
 7 
 8 #include<iostream>
 9 #include<iomanip>
10 #include<cstdio>
11 #include<algorithm>
12 #include<cmath>
13 #include<cstring>
14 #include<string>
15 #include<map>
16 #include<set>
17 #include<queue>
18 #include<vector>
19 #include<stack>
20 #define y0 abc111qqz
21 #define y1 hust111qqz
22 #define yn hez111qqz
23 #define j1 cute111qqz
24 #define tm crazy111qqz
25 #define lr dying111qqz
26 using namespace std;
27 #define REP(i, n) for (int i=0;i<int(n);++i)  
28 typedef long long LL;
29 typedef unsigned long long ULL;
30 const int inf = 0x7fffffff;
31 bool v[10][10];
32 int n;
33 int x[30],y[30];
34 
35 int dis( int x1,int y1,int x2,int y2)
36 {
37     int res ;
38     res = (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
39     return res;
40 }
41 int main()
42 {
43     while (scanf("%d",&n)!=EOF)
44     {
45     int ans = 0;
46     memset(v,false,sizeof(v));
47     for ( int i = 0 ;  i < n ; i++ )
48     {
49         scanf("%d%d",&x[i],&y[i]);
50     }
51     for ( int i = 0  ; i < n ; i++ )
52     {
53         for (int j = i+1 ; j < n ; j ++)
54         {
55         for ( int k =  j + 1 ; k < n ; k ++)
56         {
57             for ( int l = k + 1 ; l < n ; l++)
58             {
59             int d[10];
60             d[0]=dis(x[i],y[i],x[j],y[j]);
61             d[1]=dis(x[i],y[i],x[k],y[k]);
62             d[2]=dis(x[i],y[i],x[l],y[l]);
63             d[3]=dis(x[j],y[j],x[k],y[k]);
64             d[4]=dis(x[j],y[j],x[l],y[l]);
65             d[5]=dis(x[k],y[k],x[l],y[l]);
66             sort(d,d+6);
67             if (d[0]==d[1]&&d[2]==d[3]&&d[0]==d[2]&&d[4]==d[5]&&d[4]==2*d[0])
68             {
69                 ans++;
70             }
71             }
72         }
73         }
74     }
75     cout<<ans<<endl;
76 
77     }
78     return 0;
79 }
View Code

 

 
posted @ 2015-08-09 15:55  111qqz  阅读(300)  评论(0编辑  收藏  举报