PersonalCorpus 版 (精华区)

41639 2002-10-14 22:51:02 Accepted
1067 C++ 00:00.00 388K Big Guava


int main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\zju\\i1067","r",stdin);
    freopen("c:\\0acm\\zju\\o1067","w",stdout);
#endif

    int i,k,x,y,z,best_c;
    double j,best;
    int c[16][3];
    for (i=0;i<16;i++) scanf("%d%d%d\n",&c[i][0],&c[i][1],&c[i][2]);
    while (1) {
        scanf("%d%d%d\n",&x,&y,&z);
        if ((x==-1)&&(y==-1)&&(z==-1)) break;
        best=100000;
        for (i=0;i<16;i++) {
            j=sqrt((c[i][0]-x)*(c[i][0]-x)+(c[i][1]-y)*(c[i][1]-y)+
                    (c[i][2]-z)*(c[i][2]-z));
            if (j<best) {
                best=j; best_c=i;
            }
        }
        printf("(%d,%d,%d) maps to (%d,%d,%d)\n",x,y,z,c[best_c][0],
c[best_c][1],c[best_c][2]);
    }
}        
        
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.194毫秒