Pagini recente » Monitorul de evaluare | Cod sursa (job #1689948) | Cod sursa (job #940114) | Profil Ramona2007 | Cod sursa (job #2753071)
#include <bits/stdc++.h>
#define Nmax 1001
using namespace std;
set <pair <int, int> > s;
bool checkSquare(pair <int, int> x, pair <int, int> y){
int a, b;
a = x.first - y.first;
b = x.second - y.second;
if(s.find({x.first + a, x.second + b}) != s.end())
if(s.find({y.first + a, y.second + b}) != s.end())
return true;
return false;
}
int main()
{
ifstream f("patrate3.in");
ofstream g("patrate3.out");
pair <int, int> v[Nmax];
int n, ct = 0;
double c1, c2;
f >> n;
for(int i = 1; i <= n; ++i){
f >> c1 >> c2;
cout << c1 << " " << c2 << '\n';
v[i].first = round(c1 * 10000);
v[i].second = round(c2 * 10000);
s.insert(v[i]);
}
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
if(i != j && checkSquare(v[i], v[j]))
ct++;
g << ct;
return 0;
}