| ||||||||||
| 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 | |||||||||
一遍AC,贴代码(Pascal):var n,i,tr,tg,tb,cur,curi:longint;
r,g,b:array[1..16]of longint;
procedure rec;
var sr,sg,sb:longint;
begin
sr:=sqr(tr-r[i]);
sg:=sqr(tg-g[i]);
sb:=sqr(tb-b[i]);
if sr+sg+sb<cur then begin
cur:=sr+sg+sb; curi:=i;
end;
end;
begin
for i:=1 to 16 do readln(r[i],g[i],b[i]);
while true do begin
readln(tr,tg,tb);
if tr<0 then break;
cur:=maxlongint;
for i:=1 to 16 do rec;
writeln('(',tr,',',tg,',',tb,') maps to (',r[curi],',',g[curi],',',b[curi],')');
end;
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator