zoj 1608 Two Circles and a Rectangle

求2个圆可以放入一个矩形内的条件

zoj 1608 Two Circles and a Rectangle_第1张图片

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define ls rt<<1
#define rs ls1
#define lson l,mid,ls
#define rson mid+1,r,rs
#define middle (l+r)>>1
#define eps (1e-9)
#define clr_all(x,c) memset(x,c,sizeof(x))
#define clr(x,c,n) memset(x,c,sizeof(x[0])*(n+1))
#define MOD 1000000007
#define inf 100000007
#define pi acos(-1.0)
#define for(i,a,b) for(int i=(a);i<(b);i++)
#define M 200000+5
int main(){
    double a,b,r1,r2,c,d;
    while(scanf("%lf %lf %lf %lf",&a,&b,&r1,&r2)!=EOF){
c=r1+r2;
d=(a-c)*(a-c)+(b-c)*(b-c);
c*=c;
if(2*r1>a||2*r1>b||2*r2>a||2*r2>b)puts("No");
else if(d<c)puts("No");
else puts("Yes");
}
    return 0;
}

你可能感兴趣的:(ZOJ,几何)