Pagini recente » Cod sursa (job #2289876) | Cod sursa (job #2126033) | Cod sursa (job #2138236) | Cod sursa (job #2871247) | Cod sursa (job #2125860)
#include <fstream>
#include <algorithm>
#define nmax 5002
#define qmax 1002
using namespace std;
ifstream fin("patrate3.in");
ofstream fout("patrate3.out");
struct punct{
double d,s;
};
punct v[nmax*nmax*2];
double x[qmax];
double y[qmax];
bool cmp(punct A,punct B)
{
if(A.d==B.d)
return A.s<B.s;
return A.d<B.d;
}
int main()
{
int n;
fin>>n;
int con=0;
for(int i=1;i<=n;i++)
{
fin>>x[i]>>y[i];
for(int j=1;j<i;j++)
{
con++;
v[con].d=(double)(x[i]+x[j])/2.;
v[con].s=(double)(y[i]+y[j])/2.;
}
}
sort(v+1,v+con+1,cmp);
int k=1;
int contor=0;
while(k<=con)
{
int c=0;
while(v[k].d==v[k+1].d&&v[k].s==v[k+1].s)
{
c++;
k++;
}
k++;
contor+=(c*(c+1))/2;
}
fout<<contor;
return 0;
}