Advertisement
999ms

Untitled

Jan 31st, 2020
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define all(x) (x).begin(),(x).end()
  3.  
  4. using namespace std;
  5. using ll = long long;
  6.  
  7. int main() {
  8.     ios_base::sync_with_stdio(false);
  9.     cin.tie(nullptr);
  10.     cout.tie(nullptr);
  11.     int a, b, d;
  12.     cin >> a >> b >> d;
  13.     int r1l, r1h, r2l, r2h;
  14.     cin >> r1l >> r1h >> r2l >> r2h;
  15.     int h;
  16.     cin >> h;
  17.     double R1 = r1h;
  18.     double R2 = r2h;
  19.     if (h > d) {
  20.         R1 = d * 1.0 / h * (r1h - r1l) + r1l;
  21.         R2 = d * 1.0 / h * (r2h - r2l) + r2l;
  22.     }
  23.     if (R1 < R2) {
  24.         swap(R1, R2);
  25.     }
  26.     if (a < b) {
  27.         swap(a, b);
  28.     }
  29.     const double eps = 1e-9;
  30.     if (R1 * 2 > b + eps) {
  31.         cout << "NO" << endl;
  32.         return 0;
  33.     }
  34.     double dist2 = (a - R2 - R1) * (a - R2 - R1) + (b - R2 - R1) * (b - R2 - R1);
  35.     if (dist2 + eps >= r1h * r1h + 2 * r1h * r2h + r2h * r2h) {
  36.         cout << "YES" << endl;
  37.     }  else {
  38.         cout << "NO" << endl;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement