Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define all(x) (x).begin(),(x).end()
- using namespace std;
- using ll = long long;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int a, b, d;
- cin >> a >> b >> d;
- int r1l, r1h, r2l, r2h;
- cin >> r1l >> r1h >> r2l >> r2h;
- int h;
- cin >> h;
- double R1 = r1h;
- double R2 = r2h;
- if (h > d) {
- R1 = d * 1.0 / h * (r1h - r1l) + r1l;
- R2 = d * 1.0 / h * (r2h - r2l) + r2l;
- }
- if (R1 < R2) {
- swap(R1, R2);
- }
- if (a < b) {
- swap(a, b);
- }
- const double eps = 1e-9;
- if (R1 * 2 > b + eps) {
- cout << "NO" << endl;
- return 0;
- }
- double dist2 = (a - R2 - R1) * (a - R2 - R1) + (b - R2 - R1) * (b - R2 - R1);
- if (dist2 + eps >= r1h * r1h + 2 * r1h * r2h + r2h * r2h) {
- cout << "YES" << endl;
- } else {
- cout << "NO" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement