Pagini recente » Cod sursa (job #1397852) | Cod sursa (job #2522698) | Cod sursa (job #178348) | Cod sursa (job #899408) | Cod sursa (job #2755834)
#include <fstream>
#include <cmath>
#include <set>
#include<utility>
using namespace std;
int main()
{
ifstream f("patrate3.in");
ofstream g("patrate3.out");
set<pair<int,int>> points;
int n;
f>>n;
double x,y;
for(int i=0;i<n;i++)
{
f>>x>>y;
points.insert(make_pair(round(x*10000),round(y*10000)));
}
int nr=0;
int a,b,aa,bb;
for(auto i=points.begin();i!=points.end();i++)
for(auto j=points.begin();j!=points.end();j++)
{
if(i!=j)
{
a=i->second-j->second+j->first;
aa=j->first-i->first+j->second;
b=i->second-j->second+i->first;
bb=j->first-i->first+i->second;
if(points.find({a,b})!=points.end()&&points.find({aa,bb})!=points.end())
nr++;
}
}
g<<nr/4;
return 0;
}