Pagini recente » Cod sursa (job #2893710) | Cod sursa (job #2870406) | Cod sursa (job #853130) | Cod sursa (job #2527053) | Cod sursa (job #2983203)
#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
int main() {
ifstream f("patrate3.in");
ofstream g("patrate3.out");
int n; f >> n;
for(int i=1; i<=n; i++) {
float x, y; f >> x >> y;
x = round(x * 10000);
y = round(y * 10000);
s.emplace(int(x), int(y));
}
int ans = 0;
for(auto i : s)
for(auto j : s) {
if(i == j) continue;
int dx = i.second - j.second;
int dy = j.first - i.first;
pair<int, int> p1 = {dx + i.first, dy + i.second};
pair<int, int> p2 = {dx + j.first, dy + j.second};
if(s.find(p1) != s.end() and s.find(p2) != s.end()) ans++;
}
g << ans / 4;
return 0;
}