Pagini recente » Cod sursa (job #1209241) | Cod sursa (job #460652) | Cod sursa (job #713725) | Borderou de evaluare (job #1751036) | Cod sursa (job #2085715)
#include <bits/stdc++.h>
#define Nmax 1001
#define eps 10000
using namespace std;
ifstream f("patrate3.in");
ofstream g("patrate3.out");
pair <int,int> pct[Nmax];
#define x first
#define y second
int main()
{
int n,i,j;
f>>n;
double x,y;
for(i=1;i<=n;i++)
{
f>>x>>y;
pct[i].x=2*round(x*eps);
pct[i].y=2*round(y*eps);
}
sort(pct+1,pct+n+1);
int mx,my,dx,dy;
int ans=0;
for(i=1;i<n;i++)
for(j=i+1;j<=n;j++)
{
mx=(pct[i].x+pct[j].x)/2;
my=(pct[i].y+pct[j].y)/2;
dx=mx-pct[i].x;
dy=my-pct[i].y;
if(binary_search(pct+1,pct+n+1,make_pair(mx-dy,my+dx)))
if(binary_search(pct+1,pct+n+1,make_pair(mx+dy,my-dx)))
++ans;
}
g<<ans/2;
return 0;
}