Cod sursa(job #1147192)

Utilizator RusuAlexeiRusu Alexei RusuAlexei Data 19 martie 2014 17:28:57
Problema Trapez Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.09 kb
program puncte;
  var n,ans,i,j,g,h:longint;
      x,y:array [0..1000] of longint;

begin
  assign(input,'trapez.in');
  reset(input);
  assign(output,'trapez.out');
  rewrite(output);

  readln(n);
  for i:=1 to n do readln(x[i],y[i]);
  for i:=1 to n do
    for j:=i+1 to n do
      for h:=i+1 to n do
        if (h<>i)and(h<>j) then
          for g:=h+1 to n do
            if (g<>i)and(g<>j) then
              begin
                if (x[i]<>x[j])and(x[g]<>x[h])and(x[j]<>x[h]) then
                  begin
                   if ((y[i]-y[j])/(x[i]-x[j])=(y[h]-y[g])/(x[h]-x[g]))and
                   ((y[i]-y[j])/(x[i]-x[j])<>(y[i]-y[h])/(x[j]-x[h])) then
                   inc(ans);
                  end else
                  begin
                    if (x[i]=x[j])and(x[g]=x[h])and(x[j]<>x[h]) then inc(ans);
                    if (x[i]<>x[j])and(x[g]<>x[h])and(x[j]=x[h]) then
                     if ((y[i]-y[j])/(x[i]-x[j])=(y[h]-y[g])/(x[h]-x[g])) then
                     inc(ans);
                  end;

              end;
   writeln(ans);
   close(output);
end.