Pagini recente » Profil Stefania189 | Diferente pentru utilizator/stargold2 intre reviziile 275 si 81 | Cod sursa (job #652743) | Cod sursa (job #95718) | Cod sursa (job #2960897)
#include<bits/stdc++.h>
using namespace std;
ifstream r("patrate3.in");
ofstream w("patrate3.out");
int n, cnt=0;
long long dstx, dsty;
set<pair<int,int>>s;
pair<int,int>pereche1,pereche2;
int main()
{
float x1,y1;
r>>n;
for(int i=0; i<n; ++i)
{
r>>x1>>y1;
x1=round(x1*10000);
y1=round(y1*10000);
s.insert(make_pair(x1,y1));
}
for(auto x:s)
{
for(auto y:s)
{
if(x!=y)
{
dstx=x.second-y.second;
dsty=y.first-x.first;
pereche1=make_pair(dstx+x.first, dsty+x.second);
pereche2=make_pair(dstx+y.first, dsty+y.second);
if(s.find(pereche1)!=s.end() && s.find(pereche2)!=s.end())
{
cnt++;
}
}
}
}
w<<cnt/4;
return 0;
}