#include
<
stdio.h
>
#include
<
math.h
>
struct
Point

{
double
x, y, z;
}
;

Point d[
16
];

double
dis( Point
const
&
a, Point
const
&
b )

{
return
sqrt( ( a.x
-
b.x )
*
(a.x
-
b.x )
+
( a.y
-
b.y )
*
(a.y
-
b.y )
+
(a.z
-
b.z)
*
(a.z
-
b.z) );
}

int
main()

{
for
(
int
i
=
0
; i
<
16
;
++
i ) scanf(
"
%lf%lf%lf
"
,
&
d[i].x,
&
d[i].y,
&
d[i].z );
Point temp;
while
( scanf(
"
%lf%lf%lf
"
,
&
temp.x,
&
temp.y,
&
temp.z), temp.x
!=
-
1
&&
temp.y
!=
-
1
&&
temp.z
!=
-
1
)

{
double
min
=
250
*
250
+
250
*
250
+
250
*
250
+
50
;
int
k
=
-
1
;
for
(
int
i
=
0
; i
<
16
;
++
i )

{
if
( dis( d[i], temp )
<
min )

{
min
=
dis( d[i], temp );
k
=
i;
}
}
printf(
"
(%.0lf,%.0lf,%.0lf) maps to (%.0lf,%.0lf,%.0lf)\n
"
, temp.x, temp.y, temp.z, d[k].x, d[k].y, d[k].z );
}
return
0
;
}
posted on 2008-10-28 22:08
Darren 阅读(436)
评论(0) 编辑 收藏 引用 所属分类:
动态规划