Computer Science, asked by paradocs6490, 10 months ago

A convex polygon is a simple polygon whose interior is a convex set. The following properties of a simple polygon are all equivalent to convexity: - Every internal angle is less than 180 degrees. - Every line segment between two vertices remains inside or on the boundary of the polygon. Given the vertices of a polygon( x,y) ,your job is to find the area of polygon. Input Input will begin with an integer T, the number of test cases. Each test case start with integer N, the number of coordinates in the polygon followed by x1,x2,x3.............xN,y1,y2,y3......yN in each line. 1<=T<=50,1<=N<=20 and -10,000 <=x or y<=10,000 Output For every test case, output a single line containing the area of polygon. TEST CASE 1 INPUT 2 3 0 0 1 1 2 1 3 1 1 -1 1 -1 0 OUTPUT 0.5 1.0 TEST CASE 2 INPUT 2 3 1 2 1 1 2 1 3 1 2 -1 -1 -1 0 OUTPUT 0.5 1.0

Answers

Answered by mariospartan
0

Explanation:

At first, we need to input the value of the question given:

The input of the number will start as the value of A, denotes the number of test cases.

The number “N” is the test cases starting with the value of N

The polygon coordinates are written as the number in terms of x and y as x1,x2,x3..............xN

y1,y2,y3......yN  for each line design.

1 <= A <=50, 1 <= N <= 20 and - 10,000 <= x or y<= 10,000

The output for the area of the polygon is found out after inputting the values of x and y.

Similar questions