水题
#include <stdio.h>
int p[20][5], data[5];
int dis(int i)
{
return (p[i][0]-data[0])*(p[i][0]-data[0])+(p[i][1]-data[1])*(p[i][1]-data[1])+(p[i][2]-data[2])*(p[i][2]-data[2]);
}
int mindist()
{
int i, min=10000000, dist, k;
for ( i = 0; i < 16; i++ )
{
dist=dis(i);
if ( min > dist )
{
min= dist;
k= i;
}
}
return k;
}
int main()
{
int i;
for ( i = 0; i < 16; i++ )
{
scanf("%d%d%d", p[i], p[i]+1, p[i]+2);
}
while ( scanf("%d%d%d", data, data+1, data+2), data[0]!= -1 && data[1] != -1 && data[2] != -1 )
{
int j= mindist();
printf("(%d,%d,%d) maps to (%d,%d,%d)\n", data[0], data[1], data[2], p[j][0], p[j][1], p[j][2]);
}
return 0;
}