-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2002.cpp
46 lines (46 loc) · 1.04 KB
/
2002.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<map>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define add 10000
using namespace std;
struct ad{
int x,y;
bool operator < (const ad b) const{
return (x<b.x)||(x==b.x&&y<b.y);
}
ad operator + (const ad b) const{
ad c;c.x=x+(b.y-y);c.y=y-(b.x-x);
return c;
}
}A[1005];
int N,Numx,Numy,hshx[20005],hshy[20005];
bool vis[1005][1005];
int main()
{
while (1){
scanf("%d",&N);int Ans=0;
memset(vis,0,sizeof vis);
memset(hshx,0,sizeof hshx);
memset(hshy,0,sizeof hshy);
if (N==0) return 0;
Numx=Numy=0;
for (int i=1;i<=N;i++){
scanf("%d%d",&A[i].x,&A[i].y);
if (!hshx[A[i].x+add]) hshx[A[i].x+add]=++Numx;
if (!hshy[A[i].y+add]) hshy[A[i].y+add]=++Numy;
vis[hshx[A[i].x+add]][hshy[A[i].y+add]]=1;
}
for (int i=1;i<=N;i++){
for (int j=1;j<=N;j++){
if (i==j) continue;
ad b=A[i]+A[j];
if (!vis[hshx[b.x+add]][hshy[b.y+add]]) continue;
ad c=b+A[i];
if (vis[hshx[c.x+add]][hshy[c.y+add]]) Ans++;
}
}
printf("%d\n",Ans/4);
}
return 0;
}