Pagini recente » Cod sursa (job #2925436) | Cod sursa (job #862089) | Cod sursa (job #739467) | Cod sursa (job #129209) | Cod sursa (job #326086)
Cod sursa(job #326086)
#include <cstdio>
#include <algorithm>
using namespace std;
#define file_in "trapez.in"
#define file_out "trapez.out"
#define Nmax 1010
#define Inf 0x3f3f3f3f
/*struct panta
{
int x,y;
}*/
int p[Nmax*Nmax];
int n,t,nr,maxim,a,b;
int x[Nmax];
int y[Nmax];
int main()
{
int i,j;
freopen(file_in,"r",stdin);
scanf("%d", &n);
for (i=1;i<=n;++i)
scanf("%d %d", &x[i],&y[i]);
fclose(stdin);
freopen(file_out,"w",stdout);
nr=0;
for (i=1;i<n;++i)
for (j=i+1;j<=n;++j)
{
nr++;
if (x[i]-x[j]==0) p[nr]=0;
else
if (y[i]-y[j]==0) p[nr]=Inf;
else
{
p[nr]=(y[j]-y[i])/(x[j]-x[i]);
}
}
sort(p+1,p+nr+1);
t=0;
maxim=0;
for (i=1;i<nr;++i)
{
if (p[i]==p[i+1])
t++;
/*else
t=0;
if (t>maxim) maxim=t; */
}
printf("%d", t);
fclose(stdout);
return 0;
}