#P7094. Sweet Equation Challenge
Sweet Equation Challenge
Sweet Equation Challenge
In Jiangsu, Nanjing (also known as Jinling), a historical city with a rich cultural background, the local high school mock exams are notoriously challenging. In one round of review, a tricky problem was encountered. With help from a friend, the problem was easily solved, but now the challenge is thrown to you! Solve this problem and enjoy the sweet rewards!
Given four positive integers \( a, b, c, d \), count the number of pairs of positive integers \( (x, y) \) that satisfy the following equation:
[ \frac{a}{x} + \frac{b}{c} = \frac{d}{y} ]
If you manage to solve the problem, you too can taste the sweetness of success.
inputFormat
The input consists of a single line containing four space-separated positive integers: \( a \), \( b \), \( c \), and \( d \).
outputFormat
Output a single integer: the number of pairs \( (x, y) \) of positive integers that satisfy the equation.
sample
1 1 1 2
1