Pagini recente » Cod sursa (job #2749782) | Cod sursa (job #3161137) | Cod sursa (job #2310797) | Cod sursa (job #1603994) | Cod sursa (job #1425394)
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const double INFI = 2e9;
const double eps = 1e-12;
struct PCT {
int x,y;
void cit () {
int a,b;
scanf("%d%d",&a,&b);
x = a, y = b;
}
} v[1001];
double pante[550000];
double CalculPanta (PCT a, PCT b) {
int p,q;
p=a.x-b.x;
q=a.y-b.y;
if (!p)
return INFI + 1;
return (double) q / p * 1.0;
}
int main()
{
freopen("trapez.in","r",stdin);
freopen("trapez.out","w",stdout);
int n,i,j;
scanf("%d",&n);
for(i=1;i<=n;++i)
v[i].cit();
int k=1,l=1;
long long t=0;
for (i=1;i<=n;++i)
for (j=i+1;j<=n;++j)
pante[k++] = CalculPanta(v[i],v[j]);
sort (pante+1, pante+k);
for (i=2;i<k;++i) {
for (l=1;i<k&&fabs(pante[i]-pante[i+1])<eps;++i,++l);
t += l * (l - 1) >> 1;
}
printf("%lld\n",t);
return 0;
}