#include #include #include using namespace std; const double PI = 4.0*atan(1.0); const int MAXL = 120; class point { public: point(double xx=0.0, double yy=0.0) : x(xx), y(yy) {}; double x, y; }; double dist(point p1, point p2) { double dx = p1.x - p2.x; double dy = p1.y - p2.y; return sqrt(dx*dx+dy*dy); } int main() { double w, l, h, r; point p1, p2, p3; double d, theta; point lhole, rhole; double pi = 4*atan(1.0); cin >> w >> l; if (w < 0 || w > MAXL) { cout << "ERROR: width out of range: " << w << endl; return 1; } if (l < 0 || l > MAXL) { cout << "ERROR: length out of range: " << l << endl; return 2; } int ns, tots = 0; cin >> r >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> h; if (r < 1 || r >5) { cout << "ERROR: invalid r value = " << r << endl; return 3; } if (h > l/2 || h < r) { cout << "ERROR: invalid h value = " << h << endl; return 4; } if (p1.x -r < 0 || p1.x+r > w) { cout << "ERROR: ball 1 off of table " << p1.x << ',' << p1.y << endl; return 5; } if (p1.y+r > l) { cout << "ERROR: ball 1 off of table " << p1.x << ',' << p1.y << endl; return 6; } if (p1.y -r <= h) { cout << "ERROR: ball 1 below h line " << p1.x << ',' << p1.y << endl; return 7; } if (p2.x -r < 0 || p2.x+r > w) { cout << "ERROR: ball 2 off of table " << p2.x << ',' << p2.y << endl; return 8; } if (p2.y+r > l) { cout << "ERROR: ball 2 off of table " << p2.x << ',' << p2.y << endl; return 9; } if (p2.y -r <= h) { cout << "ERROR: ball 2 below h line " << p2.x << ',' << p2.y << endl; return 10; } if (p3.x -r < 0 || p3.x+r > w) { cout << "ERROR: ball 3 off of table " << p3.x << ',' << p3.y << endl; return 11; } if (p3.y+r > l) { cout << "ERROR: ball 3 off of table " << p3.x << ',' << p3.y << endl; return 12; } if (p3.y -r <= h) { cout << "ERROR: ball 3 below h line " << p3.x << ',' << p3.y << endl; return 13; } if (dist(p1, p2) <= 2*r) { cout << "ERROR: balls 1 and 2 too close " << p1.x << ',' << p1.y << ' ' << p2.x << ',' << p2.y << endl; return 14; } if (dist(p1, p3) <= 2*r) { cout << "ERROR: balls 1 and 3 too close " << p1.x << ',' << p1.y << ' ' << p3.x << ',' << p3.y << endl; return 15; } if (dist(p2, p3) <= 2*r) { cout << "ERROR: balls 2 and 3 too close " << p2.x << ',' << p2.y << ' ' << p3.x << ',' << p3.y << endl; return 16; } return 42; }