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,贴个代码,超短。var x,y:array[1..770]of longint; a,b,c:array[1..10000]of longint; ans,n,i,j,k: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 if (x[j]-x[i])*(y[k]-y[i])=(x[k]-x[i])*(y[j]-y[i]) then begin inc(ans); a[ans]:=i; b[ans]:=j; c[ans]:=k; end; end; writeln(ans); for i:=1 to ans do writeln(a[i],' ',b[i],' ',c[i]); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator