链接:
一个点到一个立方体的距离就是到各个边的最短距离#includeint main(){ int x,y,z; int x1,y1,z1; int x2,y2,z2; scanf("%d%d%d",&x,&y,&z); scanf("%d%d%d",&x1,&y1,&z1); scanf("%d%d%d",&x2,&y2,&z2); int sum=0; if(x1<=x&&x<=x2&&y1<=y&&y<=y2&&z1<=z&&z<=z2) { printf("0\n"); } else { if(x>x2) sum+=(x-x2)*(x-x2); else if(x y2) sum+=(y-y2)*(y-y2); else if(y z2) sum+=(z-z2)*(z-z2); else if(z