Pagini recente » Cod sursa (job #1379317) | Cod sursa (job #1707284) | Cod sursa (job #2434296) | Cod sursa (job #3130388) | Cod sursa (job #2622995)
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef pair <int, int> Point;
set <Point> points;
bool check(Point a, Point b)
{
if (a == b)
return false;
int dy = b.first - a.first;
int dx = a.second - b.second;
return (points.find({ a.first + dx, a.second + dy }) != points.end() &&
points.find({ b.first + dx, b.second + dy }) != points.end());
}
int main()
{
ifstream in("patrate3.in");
ofstream out("patrate3.out");
int n;
in >> n;
auto read_nr = [&]() -> int {
double x;
in >> x;
return round(x * 10000);
};
while (n--)
points.insert({ read_nr(), read_nr() });
int ans = 0;
for (auto i : points)
for (auto j : points)
ans += check(i, j);
assert(ans % 4 == 0);
out << ans / 4 << '\n';
return 0;
}