Pagini recente » Cod sursa (job #182919) | Cod sursa (job #234430) | Cod sursa (job #2534587) | Cod sursa (job #2930722) | Cod sursa (job #2624815)
#include <fstream>
#include <set>
#include <algorithm>
using namespace std;
ifstream f("patrate3.in");
ofstream g("patrate3.out");
set<pair<int, int>> p;
int verif(pair<int,int> a, pair<int,int> b)
{
int x,y;
if(a==b)
{
return 0;
}
y = b.first - a.first;
x = a.second - b.second;
return (p.find({a.first+x, a.second+y})!=p.end() && p.find({b.first+x, b.second+y})!=p.end());
}
int citeste()
{
double val;
f>>val;
return round(val*10000);
};
int main()
{
int n,i,rez = 0;
f>>n;
for(i=n; i>=0; i--)
{
p.insert({citeste(), citeste()});
}
for(auto i : p)
{
for(auto j : p)
{
rez+=verif(i, j);
}
}
g<<rez/4<<'\n';
return 0;
}