Pagini recente » Cod sursa (job #3203768) | Cod sursa (job #2798864) | Cod sursa (job #7028) | Cod sursa (job #2691166) | Cod sursa (job #2768745)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ifstream fin("patrate3.in");
ofstream fout("patrate3.out");
set<pair<int,int>> points;
int n;
fin>>n;
double x,y;
for(int i=0;i<n;i++)
{
fin>>x>>y;
points.insert(make_pair(round(x*10000),round(y*10000)));
}
int nr=0;
int x3,x4,y3,y4;
for(auto i=points.begin();i!=points.end();i++)
for(auto j=points.begin();j!=points.end();j++)
{
if(i!=j)
{
x3=i->second-j->second+j->first;
y3=j->first-i->first+j->second;
x4=i->second-j->second+i->first;
y4=j->first-i->first+i->second;
if(points.find({x3,y3})!=points.end()&&points.find({x4,y4})!=points.end())
nr++;
}
}
fout<<nr/4;
return 0;
}