Pagini recente » Cod sursa (job #1004084) | Cod sursa (job #2808158) | Cod sursa (job #192279) | Cod sursa (job #1097115) | Cod sursa (job #3356192)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("patrate3.in");
ofstream fout("patrate3.out");
int n;
struct Point {
int x, y;
bool operator<(const Point& o) const {
if (x != o.x) return x < o.x;
return y < o.y;
}
} p[1005];
int main() {
fin >> n;
for (int i = 1; i <= n; ++i) {
double x, y;
fin >> x >> y;
p[i].x = round(x * 10000.0);
p[i].y = round(y * 10000.0);
}
sort(p + 1, p + n + 1);
int ans = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (i == j) continue;
int dx = p[j].x - p[i].x;
int dy = p[j].y - p[i].y;
Point C = {p[j].x - dy, p[j].y + dx};
Point D = {p[i].x - dy, p[i].y + dx};
if (binary_search(p + 1, p + n + 1, C) && binary_search(p + 1, p + n + 1, D)) {
ans++;
}
}
}
fout << ans / 4 << "\n";
fin.close();
fout.close();
return 0;
}