#P2735. [USACO3.4] 网 Electric Fences
[USACO3.4] 网 Electric Fences
Description
In this problem, a lattice point is a point whose and coordinates are both integers.
To pen his cows, Farmer John builds a triangular electric fence. He runs a live wire from the origin to the lattice point (), then to the lattice point (), and finally back to the origin.
Cows can be placed at every lattice point strictly inside the fence without touching the fence (very skinny cows). If a lattice point touches the fence, a cow absolutely cannot be placed there (perhaps Farmer John would get a little shock). How many cows can be placed inside Farmer John’s electric fence?
Input Format
The input contains a single line with three integers separated by spaces: .
Output Format
Output a single line containing one integer, the number of cows that can be enclosed by the specified electric fence.
7 5 10
20
Hint
Problem translation is from NOCOW. USACO Training Section 3.4.
Translated by ChatGPT 5
京公网安备 11011102002149号