#include<iostream>
#include<fstream>
#include<cmath>
using namespace std;
int main(){
//ifstream cin("1.txt");
int r[16];
int g[16];
int b[16];
for(int i=0;i<16;++i)
cin>>r[i]>>g[i]>>b[i];
int r0,g0,b0;
while(cin>>r0>>g0>>b0){
if(r0==-1&&g0==-1&&b0==-1)
break;
double minnum=sqrt((r0-r[0])*(r0-r[0])+(g0-g[0])*(g0-g[0])+(b0-b[0])*(b0-b[0]));
int index=0;
for(int i=1;i<16;++i){
double m=sqrt((r0-r[i])*(r0-r[i])+(g0-g[i])*(g0-g[i])+(b0-b[i])*(b0-b[i]));
if(m<minnum){
minnum=m;
index=i;
}
}
cout<<"("<<r0<<","<<g0<<","<<b0<<") maps to ("<<r[index]<<","<<g[index]<<","<<b[index]<<")"<<endl;
}
return 0;
}
poj1046
最新推荐文章于 2019-10-03 18:23:39 发布