其实是不太好意思往博客上放的,因为是一道巨水的题,但是我却错了一次,没有判断重合,放上还是为了警示自己,尽量不要在水题上罚时
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int t; int x1,y1,r1,x2,y2,r2; scanf("%d",&t); while(t--) { scanf("%d%d%d%d%d%d",&x1,&y1,&r1,&x2,&y2,&r2); int disc = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1); int disr1 = r1*r1 + 2*r1*r2 + r2*r2; int disr2 = r1*r1 - 2*r1*r2 + r2*r2; if(x1==x2 && y1 == y2 && r1 == r2) puts("-1"); else if(disc > disr1) puts("4"); else if(disc == disr1) puts("3"); else if(disc < disr1 && disc > disr2) puts("2"); else if(disc == disr2) puts("1"); else puts("0"); } return 0; }