题意就是http://blog.csdn.net/kaisa158/article/details/47023997

刚开始把判两个点几乎重合的那个-写了sigma{sqr(每个点)}被卡精度,改成abs就a了

//By Richard
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#define rep(x,y,z) for (int x=(y);(x)<=(z);(x)++)
#define per(x,y,z) for (int x=(y);(x)>=(z);(x)--)
#define log2(x) (31-__builtin_clz(x))
#define mod (int)(1e9+7)
#define inf 0x3f3f3f3f
#define cls(x) memset(x,0,sizeof(x))
#ifdef DEBUG
#define debugdo(X) X
#define debugndo(X)
#define debugout(X) cout<<(#X)<<"="<<(X)<<endl
#else
#define debugdo(X)
#define debugndo(X) X
#define debugout(X)
#endif // debug
#ifdef ONLINE_JUDGE
#define debugdo(X)
#define debugndo(X)
#define debugout(X)
#endif
#define putarray(x,n) rep(iiii,1,n) printf("%d ",x[iiii])
#define mp make_pair
using namespace std;
typedef pair<int,int> pairs;
typedef long long LL;
/////////////////////read3.0////////////////////////////////////
template <typename T>
inline void read(T &x){char ch;x=0;bool flag=false;ch=getchar();while (ch>'9'||ch<'0') {ch=getchar();if (ch=='-') flag=true;}while ((ch<='9'&&ch>='0')){x=x*10+ch-'0';ch=getchar();}if (flag) x*=-1;}
template <typename T>
inline void read(T &x,T &y){read(x);read(y);}
/////////////////variables&functions////////////////////
typedef long double LD;
int T;
#define sqr(x) ((x)*(x))
struct point
{
    LD x,y,z;
    point(LD a=0,LD b=0,LD c=0):x(a),y(b),z(c){}
    inline bool operator<(point b)const{return x==b.x?y<b.y:x<b.x;}
    inline LD operator-(point b)const{return abs(x-b.x)+abs(y-b.y)+abs(z-b.z);}
};
double xp,yp,zp,x,y,z,xx,yy,zz;
const LD eps=0.000000000001;
LD dis(const point &x,const point &y)
{
    return sqrt(sqr(x.x-y.x)+sqr(x.y-y.y)+sqr(x.z-y.z));
}
int main()
{
    read(T);
    rep(iii,1,T)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf",&xp,&yp,&zp,&x,&y,&z,&xx,&yy,&zz);
        point pp(xp,yp,zp);
        point l(x,y,z),r(xx,yy,zz);
        if (r<l) swap(l,r);
        while (r-l>eps)
        {
            point ll((r.x-l.x)/3+l.x,(r.y-l.y)/3+l.y,(r.z-l.z)/3+l.z),rr((r.x-l.x)*2/3+l.x,(r.y-l.y)*2/3+l.y,(r.z-l.z)*2/3+l.z);
            LD disll=dis(pp,ll),disrr=dis(pp,rr);
            if (disll<disrr) r=rr;
            else l=ll;
        }
        printf("Case %d: %.2lf\n",iii,(double)dis(pp,l));
    }
    return 0;
}