Question: You need to add a polygon block to the ground plate of the smallest Convex Polygon and ask the percentage of the remaining space in the area of the convex polygon. Analysis: Computation of geometric and convex hull. Find the convex hull, and then divide the area difference between the polygon and convex hull by the area of the convex hull. Note: Positive and Negative vertices must be in the direction, and the vector area must be de-absolute values. [Cpp] # include <algorithm> # include <iostream> # include <cstdlib> # include <cstdio> # include <cmath> using namespace std; // point structure typedef struct pnode {int x, y, d;} point; point P [106]; // use the AB * ac int crossproduct (point a, point B, point c) {return (B. x-a.x) * (c. y-a.y)-(c. x-a.x) * (B. y-a.y);} // point-to-point distance int dist (point a, point B) {return (. x-b.x) * (. x-b.x) +. y-b.y) * (. y-b.y);} // coordinate sorting bool cmp1 (p Oint a, point B) {return (a. x = B. x )? (. Y <B. y) :(. x <B. x);} // rank bool cmp2 (point a, point B) {double cp = crossproduct (P [0], a, B); if (! Cp) return. d <B. d; else return cp> 0 ;}// calculate the convex hull double Graham (int n) {double S1 = 0.0; for (int I = 1; I <n-1; ++ I) s1 ++ = 0.5 * crossproduct (P [0], P [I], P [I + 1]); sort (P + 0, P + n, cmp1 ); for (int I = 1; I <n; ++ I) P [I]. d = dist (P [0], P [I]); sort (P + 1, P + n, cmp2); int top = 1; for (int I = 2; I <n; ++ I) {while (top> 0 & crossproduct (P [top-1], P [top], P [I]) <= 0) -- top; P [++ top] = P [I];} double S2 = 0.0; for (int I = 1; I <top; ++ I) s2 + = 0.5 * crossproduct (P [0], P [I], P [I + 1]); return 100.0 * (fabs (S2)-fabs (S1 )) /fabs (S2);} int main () {int n, t = 1; while (scanf ("% d", & n) {for (int I = 0; I <n; ++ I) scanf ("% d", & P [I]. x, & P [I]. y); printf ("Tile # % d \ n", t ++); printf ("Wasted Space = %. 2lf % \ n ", Graham (n);} return 0 ;}