传送门
http://www.lydsy.com/JudgeOnline/problem.php?id=1610
题目大意
给n个点,有多少种斜率
题解
直接求斜率,然后排序判断即可,注意不存在斜率的情况
var
z:array[0..40005]of double;
x,y:array[0..205]of longint;
i,j,k:longint;
n,len,ans:longint;
procedure sort(l,r:longint);
var i,j:longint; a,b:real;
begin
i:=l; j:=r; a:=z[(l+r) div 2];
repeat
while z[i]<a do inc(i);
while a<z[j] do dec(j);
if not(i>j) then
begin
b:=z[i]; z[i]:=z[j]; z[j]:=b;
inc(i); dec(j);
end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
readln(n); len:=0;
for i:=1 to n do
readln(x[i],y[i]);
for i:=1 to n do
for j:=i+1 to n do
begin
inc(len);
if x[i]=x[j]
then z[len]:=maxlongint
else z[len]:=(y[i]-y[j])/(x[i]-x[j]);
end;
sort(1,len); {z[i]}
z[0]:=-2; ans:=0;
for i:=1 to len do
if z[i]<>z[i-1]
then inc(ans);
writeln(ans);
end.