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,贴个代码,超短。

Posted by 415599088 at 2011-08-11 14:59:46 on Problem 3174
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:
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