G.W. CCC 2024 Prep Problem 3: Kirk, Triangles, and Squares
Kirk just got into grade 4! To celebrate, he wants to practice geometry problems to stay on top of his game.
Kirk is very smart for a 4th grader, so his teacher gives him \(N\) squares and triangles to calculate the combined area of. The teacher still knows Kirk's level though, so the teacher makes it easier by making all of the shapes have at least one side parallel to the x-axis and making all of the shapes have integer areas. As well, the shapes will never overlap.
Kirk struggles with this problem. He asks all his friends and yet no one can solve it. Troubled, he asks his teacher for help, but it turns out the teacher gets stumped too!
As such, the teacher decides to ask you for help by giving you the shapes on a cartesian plane and asking you to calculate the answer. Can you help Kirk and his friends?
The first line will contain \(N\), the number of shapes given to Kirk. \(\{\text{1 } \leq N \leq 10 \}\)
The next \(N\) lines will contain the coordinates of a shape, in the form \(X\)\(1\) \(Y\)\(1\) \(X\)\(2\) \(Y\)\(2\) ... where \(X\)\(i\) \(Y\)\(i\) represents a vertex of the shape
On one line, output the area of all of the shapes combined.
Sample Input 1:
Sample Output 1:
Submit Solution