H
进攻
https://ac.nowcoder.com/acm/contest/8564/A
相交就是俩圆圆心距离d的问题:d小于R+r并且大于abs(R-r)就🆗了
#include<iostream> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { long long x1,y1,r1,x2,y2,r2,m; scanf("%lld%lld%lld%lld%lld%lld",&x1,&y1,&r1,&x2,&y2,&r2); long long edge_max = (x1-x2)*(x1-x2) +(y1-y2)*(y1-y2); if(r1<r2) { m=r1;r1=r2;r2=m; } long long R_r = (r1-r2)*(r1-r2) ; long long max = (r1+r2)*(r1+r2); if(R_r<=edge_max&&edge_max<=max) { printf("YES\n"); } else printf("NO\n"); } }