http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1199
精度问题啊,都快把我折磨死了,直到去掉sqrt后才通过,悲剧啊
#include<stdio.h> int main() { int n,i; double x1,x2,y1,y2,r1,r2,d,x,y,r; scanf(" %d",&n); for (i=0;i scanf(" %lf%lf%lf%lf%lf%lf",&x1,&y1,&r1,&x2,&y2,&r2); d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); r=r1>r2?r1-r2:r2-r1; if (r1==r2||d<=r*r) printf(" Impossible./n"); else { x=x1-r1*(x2-x1)/(r2-r1); y=y1-r1*(y2-y1)/(r2-r1); printf(" %.2f %.2f/n",x,y); } } return 0; }