POJ1046;Color me less

#include
using namespace std;
int p[16][3];
int main()
{
for(int i=0;i<16;i++)
{
cin>>p[i][0]>>p[i][1]>>p[i][2];
}

int x,y,z;
while(cin>>x>>y>>z)
{
if(x==-1&&y==-1&&z==-1)
break;
int tmp,j,distance=99999999;
for (int i=0;i<16;i++)
{
tmp=(x-p[i][0])*(x-p[i][0])+(y-p[i][1])*(y-p[i][1])+(z-p[i][2])*(z-p[i][2]);
if(tmp
{
distance=tmp;
j=i;
}
}

cout<<"("<<x<<","<<y<<","<<z<<")maps to("<<p[j][0]<<","<<p[j][1]<<","<<p[j][2]<<")"<<endl;
}
return 0;
}


你可能感兴趣的:(POJ1046;Color me less)