Cod sursa(job #917080)
| Utilizator | Data | 17 martie 2013 12:05:06 | |
|---|---|---|---|
| Problema | Trapez | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
freopen("trapez.in","r",stdin);freopen("trapez.out","w",stdout);
float x[1001],y[1001],v[500505];int n,s=0,i,j,k=0;
scanf("%d",&n);
for(i=1;i<=n;++i)
{
scanf("%f%f",&x[i],&y[i]);
for(j=i-1;j>=1;--j)
v[++k]=(y[i]-y[j])/(x[i]-x[j]);
}
sort(v+1,v+k+1);
for(i=1;i<k;++i)
if(v[i]!=v[i+1])
s+=j,j=0;
else
++j;
printf("%d",s+j);
}
