P2833 Equation
Background
One day, ZKC had a sudden idea. Staring at the sky, he came up with a nice problem, but after racking his brains he could not solve it, so he asks you to help him.
Description
Given $a, b, c, x_1, x_2, y_1, y_2$, find how many pairs of integer solutions satisfy $ax + by + c = 0$, with $x \in [x_1, x_2]$ and $y \in [y_1, y_2]$.
Input Format
A single line contains seven integers $a, b, c, x_1, x_2, y_1, y_2$, separated by spaces.
Output Format
Output the number of pairs of integer solutions.
Explanation/Hint
For $30\%$ of the testdata, the absolute values of $a, b, c, x_1, x_2, y_1, y_2$ do not exceed $1000$.
For $100\%$ of the testdata, the absolute values of $a, b, c, x_1, x_2, y_1, y_2$ do not exceed $10^8$.
Translated by ChatGPT 5