/* A room with a convex polygon is provided. According to the feng shui requirements, the two circular carpets are placed in the room. They cannot be folded, cut, or overlap. Ask how much space can be covered and output the coordinates of the center of the two carpets. After multiple group solutions output one of the polygon edges moving inside R, the half plane cross area can be placed into a feasible area of the circle */# include <stdio. h> # include <string. h> # include <stdlib. h> # include <math. h ># include <algorithm> using namespace STD; const int maxn = 105; const int maxm = 1005; const double EPS = 1e-5; const double Pi = ACOs (-1.0 ); struct point {Double X, Y ;}; struct line {point A, B ;}; point PNT [maxn], Res [maxm], TP [maxm]; double xmult (point op, point sp, point EP) {return (sp. x-op.x) * (Ep. y-op.y)-(sp. y-op.y) * (Ep. x-op.x);} double dist (point a, point B) {return SQRT (. x-b.x) * (. x-b.x) +. y-b.y) * (. y-b.y);} void get_equation (point P1, point P2, double & A, double & B, double & C) {A = p2.y-p1.y; B = p1.x-p2.x; C = p2.x * p1.y-p1.x * p2.y;} // linear equation point intersection (point P1, point P2, double A, double B, double C) {double U = FABS (A * p1.x + B * p1.y + C); Double V = FABS (A * p2.x + B * p2.y + C); point tt; TT. X = (p1.x * V + p2.x * u)/(U + V); TT. y = (p1.y * V + p2.y * u)/(U + V); Return tt;} // intersection, returns the double getarea (point P [], int N) {double sum = 0; For (INT I = 2; I <n; I ++) {sum + = xmult (P [1], p [I], P [I + 1]);} return-sum/2.0;} // area, clockwise is void cut (double A, double B, double C, Int & CNT) {int temp = 0; For (INT I = 1; I <= CNT; I ++) {If (A * res [I]. X + B * res [I]. Y + C>-EPS) {//> = 0tp [++ temp] = res [I];} else {If (A * res [I-1]. X + B * res [I-1]. Y + C> EPS) {TP [++ temp] = intersection (RES [I-1], Res [I], a, B, c );} if (A * res [I + 1]. X + B * res [I + 1]. Y + C> EPS) {TP [++ temp] = intersection (RES [I], Res [I + 1], a, B, c );}}} for (INT I = 1; I <= temp; I ++) RES [I] = TP [I]; Res [0] = res [temp]; res [temp + 1] = res [1]; CNT = temp;} void solve (int n, double r) {If (getarea (PNT, n) <EPS) reverse (PNT + 1, PNT + 1 + n); PNT [0] = PNT [N]; PNT [n + 1] = PNT [1]; for (INT I = 0; I <= n + 1; I ++) RES [I] = PNT [I]; int CNT = N; For (INT I = 1; I <= N; I ++) {double A, B, C; Point P1, P2, P3; p1.y = PNT [I]. x-PNT [I + 1]. x; p1.x = PNT [I + 1]. y-PNT [I]. y; Double K = r/SQRT (p1.x * p1.x + p1.y * p1.y); p1.x = K * p1.x; p1.y = p1.y * k; p2.x = p1.x + PNT [I]. x; p2.y = p1.y + PNT [I]. y; p3.x = p1.x + PNT [I + 1]. x; p3.y = p1.y + PNT [I + 1]. y; // move the r part get_equation (P2, P3, A, B, C); cut (a, B, c, CNT);} double max_dis = 0; point S, T; For (INT I = 1; I <= CNT; I ++) {for (Int J = 1; j <= CNT; j ++) {double D = dist (RES [I], Res [J]); If (D + EPS> max_dis) {max_dis = D; S = res [I]; T = res [J] ;}} printf ("%. 4lf %. 4lf %. 4lf %. 4lf \ n ", S. x, S. y, T. x, t. y) ;}int main () {int N; Double R; while (scanf ("% d % lf", & N, & R) = 2) {for (INT I = 1; I <= N; I ++) {scanf ("% lf", & PNT [I]. x, & PNT [I]. y);} solve (n, R);} return 0 ;}