Pagini recente » Cod sursa (job #7933) | Cod sursa (job #3203768) | Cod sursa (job #2798864)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("patrate3.in");
ofstream fout ("patrate3.out");
set <pair<int, int>> M;
int main()
{
int n, cnt = 0;
fin >> n;
for (int i = 1; i <= n; i++)
{
double x , y;
fin >> x >> y;
int int_x = x * 10000;
int int_y = y * 10000;
M.insert({int_x, int_y});
}
for (auto i = M.begin(); i != M.end (); i++)
for (auto j = M.begin(); j != M.end (); j++)
{
if (i != j)
{
pair <int,int> C, D;
C = D = {0 , 0};
C.first = i -> first + (i -> second - j -> second);
C.second = i -> second + (j -> first - i -> first);
D.first = j -> first + (i -> second - j -> second);
D.second = j -> second + (j -> first - i -> first);
if (M.find (C) != M.end () && M.find (D) != M.end ())
cnt++;
}
}
fout << cnt / 4 << "\n";
return 0;
}