Pagini recente » Cod sursa (job #1278411) | Cod sursa (job #1758954) | Cod sursa (job #2160605) | Cod sursa (job #2770935) | Cod sursa (job #2179060)
#include <bits/stdc++.h>
#define EPS 0.0000001
using namespace std;
ifstream in("patrate3.in");
ofstream out("patrate3.out");
struct point{
double x, y;
bool operator < (const point& other) const {
return (abs(x - other.x) < EPS ? y < other.y - EPS : x < other.x - EPS);
}
};
int n, cnt;
point P[1010];
set <point> h;
int main(){
in >> n;
for(int i = 1; i <= n; i++)
in >> P[i].x >> P[i].y, h.insert(P[i]);
sort(P + 1, P + n + 1);
for(int i = 1; i < n; i++){
for(int j = i + 1; j <= n; j++){
point M, A, B;
M.x = (P[i].x + P[j].x) / 2;
M.y = (P[i].y + P[j].y) / 2;
double H = abs(P[j].y - M.y);
double L = abs(P[j].x - M.x);
if(P[j].y < P[i].y)
H = -H;
A.x = M.x - H;
A.y = M.y + L;
B.x = M.x + H;
B.y = M.y - L;
if(h.count(A) && h.count(B))
cnt++;
}
}
out << cnt / 2;
return 0;
}