@994495jj
2017-08-07T01:41:31.000000Z
字数 1567
阅读 754
201708 (ACM)数学 (ACM)几何
#include<cstdio>#include<algorithm>#include<cmath>using namespace std;#define fi first#define se second#define pb push_back#define sz(a) (int)a.size()#define mp make_pair#define rep(i, a, b) for(int i=(a); i<(b); i++)#define de(a) cout<<#a<<"="<<a<<endl;typedef long long ll;//--------double A,B,X,Y;bool solve() {if(A>B) swap(A,B);if(X>Y) swap(X,Y);if(X<A&&Y<B) return 1;if(X*X+Y*Y>A*A+B*B) return 0;double t2=X*X+Y*Y;double a=(A-sqrt(t2-B*B))/2;double b=(B-sqrt(t2-A*A))/2;if(a*a+b*b>X*X) return 1;return 0;}int main() {while(~scanf("%lf%lf%lf%lf",&A,&B,&X,&Y)) {if(A<1||B<1||X<1||Y<1) break;if(solve()) puts("Escape is possible.");else puts("Box cannot be dropped.");}return 0;}
#include<cstdio>#include<algorithm>#include<cmath>using namespace std;#define fi first#define se second#define pb push_back#define sz(a) (int)a.size()#define mp make_pair#define rep(i, a, b) for(int i=(a); i<(b); i++)#define de(a) cout<<#a<<"="<<a<<endl;typedef long long ll;//--------bool check(double A,double B,double X,double Y) {if(A>B) swap(A,B);if(X>Y) swap(X,Y);if(X<=A&&Y<=B) return 1;if(X*X+Y*Y>=A*A+B*B) return 0;double t2=X*X+Y*Y;double a=(A-sqrt(t2-B*B))/2;double b=(B-sqrt(t2-A*A))/2;if(a*a+b*b>=X*X) return 1;return 0;}bool solve(double a,double b,double c,double d,double e) {if(check(d,e,a,b)) return 1;if(check(d,e,a,c)) return 1;if(check(d,e,b,c)) return 1;return 0;}int main() {freopen("bricks.in", "r", stdin);freopen("bricks.out", "w", stdout);double a,b,c,d,e;while(~scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e)) {if(solve(a,b,c,d,e)) puts("YES");else puts("NO");}return 0;}
