#include #include #include using namespace std; double x, y, d; double R; const double STEP = 1e-2; const double PI = 4.0 * atan(1.0); double sq(double a) { return a * a; } double fabs(double a) { if (a < 0.0) return -a; else return a; } void pushProperly(double curd) { double xp = x - curd, yp = y; double dist = sqrt( sq(xp) + sq(yp) ); double scaler = R / dist; xp *= scaler; yp *= scaler; x = xp + curd; y = yp; } double C; double evalCrazy(double alpha) { return -log(1.0/sin(alpha) + 1.0/tan(alpha)); } double accurateDist(double ang) { return (evalCrazy(ang) + C) * R; } int main() { freopen("mp.in", "r", stdin); freopen("mp.out", "w", stdout); bool switcheroo = false; scanf("%lf %lf %lf", &x, &y, &d); if (y < 0.0) { y = -y; switcheroo = true; } R = sqrt(sq(x) + sq(y)); double angBegin = atan2(y, x); C = -evalCrazy(angBegin); double l = angBegin, r = PI - 1e-10, mid, best = angBegin; int iter = 0; while(r - l > 1e-10 && iter < 150) { mid = (l + r) / 2.0; double dmid = accurateDist(mid); if (dmid <= d) { best = mid; l = mid; } else r = mid; iter++; } double x = (cos(best) * R) + d; double y = sin(best) * R; if (switcheroo) { y = -y; } printf("%.5f %.5f\n", x, y); return 0; }