Pagini recente » Cod sursa (job #2020023) | Cod sursa (job #1616771) | Cod sursa (job #1107397) | Cod sursa (job #2387264) | Cod sursa (job #2770089)
#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 = next(i); j != points.end(); ++j)
///for(auto j = next(i,1); j != points.end(); ++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 / 2;
return 0;
}