Pagini recente » Cod sursa (job #3039770) | Cod sursa (job #1519336) | Cod sursa (job #772725) | Cod sursa (job #1427648) | Cod sursa (job #284639)
Cod sursa(job #284639)
var f,g:text;
a,b,c:array[0..1001] of longint;
numar,i,md,j,n,k:longint;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=c[(l+r) div 2];
repeat
while c[i]<x do i:=i+1;
while x<c[j] do j:=j-1;
if i<=j then begin
y:=c[i];
c[i]:=c[j];
c[j]:=y;
i:=i+1;
j:=j-1;
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(f,'trapez.in');reset(f);
assign(g,'trapez.out');rewrite(g);
read(f,n);
for i:=1 to n do read(f,a[i],b[i]);
for i:=1 to n do
for j:=1 to n do
if i<>j then
if b[i]<>b[j] then begin
md:=(a[j]-a[i])div(b[j]-b[i]);
inc(k);
c[k]:=md;
end;
qsort(1,n);
numar:=0;
i:=1;
while i<=k do begin
while c[i]=c[i+1] do inc(i);
inc(numar);
end;
writeln(g,numar);
close(f);
close(g);
end.