The core of this question is to find the area of any polygon. We can use cross product to calculate. Take any one point and take two adjacent points clockwise to form two vectors with this point for cross product. All cross-border products obtained in a clockwise week are divided by two, that is, the area of the polygon. [Cpp] # include <iostream> # include <stdio. h> # include <stdlib. h> # include <string. h> # include <math. h ># include <vector> using namespace std; struct Point {double x; double y ;}; Point p [100000]; double cross (Point O, Point A, Point B) {return (. x-O. x) * (B. y-O. y)-(B. x-O. x) * (. y-O. y);} int main () {# ifndef ONLINE_JUDGE freopen ("in.txt", "r", stdin); # endif int n; double vol; while (scanf ("% D", & n )! = EOF & n> = 3) {p [0]. x = p [0]. y = 0; for (int I = 1; I <= n; I ++) {scanf ("% lf", & p [I]. x, & p [I]. y);} scanf ("% lf", & vol); p [n + 1]. x = p [1]. x; p [n + 1]. y = p [1]. y; double area = 0; for (int I = 1; I <= n; I ++) {area + = cross (p [0], p [I], p [I + 1]);} area =-area; area/= 2; double len; len = vol/area; printf ("BAR LENGTH: %. 2lf \ n ", len );}}