Pagini recente » Cod sursa (job #1434619) | Cod sursa (job #2311839) | Cod sursa (job #2225281) | Cod sursa (job #434928) | Cod sursa (job #1870134)
#include <fstream>
#include <set>
#include <cstring>
#define H(x,y) (x*1e9+y)
#define Ref &
using namespace std;
ifstream in ("patrate3.in");
ofstream out ("patrate3.out");
const int NMax=1005;
pair <int,int> Puncte[NMax];
set<long long> Setu;
string buff;
bool Solve(int arg1,int arg2)
{
long long x1=Puncte[arg1].first;
long long y1=Puncte[arg1].second;
long long x2=Puncte[arg2].first;
long long y2=Puncte[arg2].second;
long long dx=x2-x1;
long long dy=y1-y2;
long z1=x1+dy,t1=y1+dx;
long z2=x2+dy,t2=y2+dx;
return ((Setu.find(H(z1, t1))!= Setu.end()) && (Setu.find(H(z2, t2)) != Setu.end()));
}
void Carol_Cel_Mare(long long Ref x)//cica asta e Read
{
int pos=0;
bool s=false;
x=0;
in>>buff;
if (buff[pos]=='-')
{
s=1;
pos++;
}
while ((unsigned)pos<buff.length())
{
if (buff[pos]>='0'&&buff[pos]<='9')
{
x=x*10+buff[pos]-'0';
}
pos++;
}
if(s)
x=-x;
}
int main()
{
long long n,ans,finc,sjn;
in>>n;
//finc e x
//sjn e y
for (int i=1;i<=n;i++)
{
Carol_Cel_Mare(finc);
Carol_Cel_Mare(sjn);
Puncte[i]=make_pair(finc,sjn);
Setu.insert(H(finc,sjn));
}
ans=0;
for (int i=1;i<=n;i++)
{
for (int j=i+1;j<=n;j++)
{
ans+=Solve(i,j);
ans+=Solve(j,i);
}
}
out<<ans/4;
return 0;
}