Cod sursa(job #1147271)

Utilizator braisaMiron Raisa braisa Data 19 martie 2014 18:28:13
Problema Trapez Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.88 kb
var n,rs,i,j,k,z:longint;
    aux1,aux2:real;
    x,y:array[1..1010] of longint;

begin
assign(input,'trapez.in');
assign(output,'trapez.out');
reset(input);
rewrite(output);
 readln(n);
  for i:=1 to n do
   begin
    read(x[i]);
    readln(y[i]);
   end;

   for i:=1 to n-3 do
    for j:=i+1 to n-2 do
     for k:=j+1 to n-1 do
      for z:=k+1 to n do
       begin
        if (x[j]-x[i]<>0) and (x[z]-x[k]<>0) then
         begin
          aux1:=(y[j]-y[i])/(x[j]-x[i]);
          aux2:=(y[z]-y[k])/(x[z]-x[k]);
          if aux1=aux2 then inc(rs);
         end;
        if (x[j]-x[z]<>0) and (x[i]-x[k]<>0) then
         begin
          aux1:=(y[j]-y[z])/(x[j]-x[z]);
          aux2:=(y[i]-y[k])/(x[i]-x[k]);
          if aux1=aux2 then inc(rs);
         end;
       end;

       writeln(rs);


close(input);
close(output);
{Totusi este trist in lume}
end.