Test instructions: Draw a triangle on the checkered paper to find the number of lattice points contained within the triangle
Because one of the edges is the x-axis, the first thing to think about is to figure out the corresponding mathematical function for two edges, and then enumerate the x-coordinate values for solving. But it doesn't have to be that troublesome.
Pique theorem: given vertex coordinates are simple polygons of the whole point (or square lattice), the pique theorem illustrates the relationship between the area A and the number of inner lattice points i, and the number of lattice points on the edge: A = I + b/2-1.
It's a good rule to have this theorem.
The triangular area can be calculated directly with the formula.
For segments from points (0,0) to point (x, y), the number of lattice points on that segment is gcd (x, y) +1
So A and b all have, set the formula on the line.
Usaco 3.4 Electric Fence pique theorem