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

PASCAL!

Posted by qiuwenhua at 2012-08-24 16:15:04 on Problem 1046
ar a,b,c:array[1..16] of integer;
   x,y,z,i,aa,bb,cc:integer;
   s:array[1..16] of double;
   min:double;
begin
  for i:=1 to 16 do  readln(a[i],b[i],c[i]);
  readln(x,y,z);
  while (x<>-1)and(y<>-1)and(z<>-1) do
  begin
    min:=1000000;
    for i:=1 to 16 do
    begin
      s[i]:=sqrt(sqr(x-a[i])+sqr(y-b[i])+sqr(z-c[i]));
      if s[i]<min then
      begin
        aa:=a[i];
        bb:=b[i];
        cc:=c[i];
        min:=s[i];
      end;
    end;
    writeln('(',x,',',y,',',z,') maps to (',aa,',',bb,',',cc,')');
    readln(x,y,z);
  end;
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