Description
Input
Output
Sample Input
4
-1 1
-2 0
0 0
1 1
-1 1
-2 0
0 0
1 1
Sample Output
4
HINT
var
i,j,k,n,tot,ans:longint;
x,y:array[1..200] of integer;
d:array[1..40000] of double;
procedure qs(N,M:LONGINT);
var
i,j:longint;
k,t:double;
t2:boolean;
begin
i:=n;
j:=m;
k:=d[(n+m) div 2];
repeat
while d[i]<k do inc(i);
while d[j]>k do dec(j);
if i<=j then
begin
t:=d[i];
d[i]:=d[j];
d[j]:=t;
inc(i);
dec(j);
end;
until i>j;
if i<m then qs(i,m);
if n<j then qs(n,j);
end;
begin
readln(n);
for i:=1 to n do
readln(x[i],y[i]);
for i:=1 to n do
for j:=1 to n do
if i<>j then
begin
inc(tot);
if y[j]=y[i] then
d[tot]:=0
else
if x[i]=x[j] then
d[tot]:=1e30
else
d[tot]:=(y[j]-y[i])/(x[j]-x[i]);
end;
qs(1,tot);
i:=0;
while i<tot do
begin
inc(i);
inc(ans);
while d[i+1]=d[i] do
inc(i);
end;
writeln(ans);
end.
本文介绍了一款考验逻辑思维的游戏,玩家需在给定的N个点中找出所有互不平行的直线,通过计算不同斜率实现得分最大化。
5271

被折叠的 条评论
为什么被折叠?



