Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我N^3,为什么TLE(pascal这是我的程序 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator