显示代码纯文本
program P2090;
const
eps=0.0000000001;
var
a,b,a0,b0,c:array[1..100] of longint;
i,j,k,n,ans,sum,cnt:longint;
procedure swap(var u,v:longint);
var
tmp:longint;
begin
tmp:=u;
u:=v;
v:=tmp;
end;
procedure qsort(l,r:longint);
var
i,j,x,y,m:longint;
begin
i:=l;
j:=r;
m:=l+random(r-l+1);
x:=a[m];
y:=b[m];
repeat
while (a[i]<x) or ((a[i]=x) and (b[i]<y)) do inc(i);
while (x<a[j]) or ((x=a[j]) and (y<b[j])) do dec(j);
if not(i>j) then
begin
swap(a[i],a[j]);
swap(b[i],b[j]);
inc(i);
j:=j-1;
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'asm_fuel.in');assign(output,'asm_fuel.out');
reset(input);rewrite(output);
randomize;
readln(n);
for i:=1 to n do
readln(a[i],b[i]);
qsort(1,n);
cnt:=1;
a0[1]:=a[1];
b0[1]:=b[1];
c[1]:=1;
for i:=2 to n do
if (a[i]<>a[i-1]) or (b[i]<>b[i-1]) then
begin
inc(cnt);
a0[cnt]:=a[i];
b0[cnt]:=b[i];
c[cnt]:=1;
end
else inc(c[cnt]);
ans:=1;
for i:=1 to cnt do
for j:=i+1 to cnt do
if a0[i]=a0[j] then
begin
sum:=c[i]+c[j];
for k:=j+1 to cnt do
if a0[k]=a0[i] then inc(sum,c[k])
else break;
if sum>ans then ans:=sum;
end
else
begin
sum:=c[i]+c[j];
for k:=j+1 to cnt do
begin
if a0[k]=a0[j] then continue;
if abs((b0[k]-b0[j])/(a0[k]-a0[j])-
(b0[j]-b0[i])/(a0[j]-a0[i]))<eps then inc(sum,c[k]);
end;
if sum>ans then ans:=sum;
end;
writeln(ans);
close(input);close(output);
end.