Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我N^3,为什么TLE(pascal

Posted by sxqqslf at 2010-10-22 20:11:57 on Problem 3174
这是我的程序
program align;
var
  n,i,j,k,ans:longint;
  p1,p2,q1,q2:real;
  a:array[0..1000,1..3] of longint;
  x,y:array[0..1000] of longint;
begin
  readln(n);
  for i:=1 to n do readln(x[i],y[i]);
  for i:=1 to n-2 do
    for j:=i+1 to n-1 do
      for k:=j+1 to n do
      begin
        p1:=x[j]-x[i];p2:=y[j]-y[i];
        q1:=x[k]-x[j];q2:=y[k]-y[j];
        if p1*q2=q1*p2 then
        begin
          inc(ans);
          a[ans,1]:=i;a[ans,2]:=j;a[ans,3]:=k;
        end;
      end;
  writeln(ans);
  for i:=1 to ans do
    writeln(a[i,1],' ',a[i,2],' ',a[i,3]);
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator