|
|
вернуться в форумRe: WA #20 ? #include <iostream> #include <cstdio> #include <cmath> using namespace std; const float eps = 0.0001; class circle{ public : float x, y, r; circle(float _x = 0, float _y = 0, float _r = 0) { x = _x; y = _y; r = _r; } }; class plate { public : circle a, b; }; plate u, v; circle t, g; float A, B, C, h, R1, R2; float dist(circle f1, circle f2) { return sqrt((f1.x - f2.x)*(f1.x - f2.x)+(f1.y - f2.y)*(f1.y - f2.y)); } int main() { cin >> A >> B >> C; cin >> u.a.r >> u.b.r; cin >> v.a.r >> v.b.r; R1 = u.b.r; R2 = v.b.r; cin >> h; if(h > C) u.b.r = (u.b.r + u.a.r) * C / h, v.b.r = (v.b.r + v.a.r) * C / h; t = circle(u.b.r, u.b.r, u.b.r); g = circle(A - v.b.r, B - v.b.r, v.b.r); if(t.x < 0 || t.y < 0 || g.x < 0 || g.y < 0) { cout << "NO"; return 0; } if(t.x > A || t.y > B || g.x > A || g.y > B) { cout << "NO"; return 0; } if(!(t.x - t.r > -eps && t.x + t.r - A < eps && t.y - t.r > -eps && t.y + t.r - B < eps)) { cout << "NO"; return 0; } if(!(g.x - g.r > -eps && g.x + g.r - A < eps && g.y - g.r > -eps && g.y + g.r - B < eps)) { cout << "NO"; return 0; } if(R1 + R2 > dist(t, g))cout << "NO"; else cout << "YES"; return 0; } Re: WA #20 ? Such a complex program.... |
|
|