Pagini recente » Cod sursa (job #590229) | Cod sursa (job #2881135) | Cod sursa (job #2543452) | Cod sursa (job #2813194) | Cod sursa (job #2716513)
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
ifstream fin("patrate3.in");
ofstream fout("patrate3.out");
const int NMAX = 1024;
int N;
pair<int,int> a[NMAX];
bool check(const int &i, const int &j) {
if(a[i] == a[j])
return false;
pair<int,int> p1, p2;
int diffX = a[j].first - a[i].first,
diffY = a[j].second - a[i].second;
p1.first = a[i].first + diffX;
p1.second = a[i].second + diffY;
p2.first = a[j].first + diffX;
p2.second = a[j].second + diffY;
return binary_search(a, a + N, p1) && binary_search(a, a + N, p2);
}
int main() {
fin >> N;
for(int i = 0; i < N; ++i) {
ld x, y;
fin >> x >> y;
a[i].first = round(x * 10000);
a[i].second = round(y * 10000);
}
sort(a, a + N);
int ans = 0;
for(int i = 0; i < N; ++i)
for(int j = 0; j < N; ++j)
ans += check(i, j);
fout << ans / 4 << '\n';
}