#C7034. Mary's Jumps
Mary's Jumps
Mary's Jumps
Mary wants to reach exactly a target position D using two types of jumps: a long jump of length L and a short jump of length S. She can use any non-negative number of each type of jump. The problem is to determine whether Mary can reach the position D. Mathematically, Mary can reach D if and only if:
\( D \mod \gcd(L, S) = 0 \)
where \(\gcd(L, S)\) denotes the greatest common divisor of L and S. If the above condition holds, output "YES"; otherwise, output "NO" for that test case.
Example:
Input: 3 3 5 13 4 6 11 7 2 14</p>Output: YES NO YES
inputFormat
The first line of input contains a single integer T representing the number of test cases. Each of the following T lines contains three space-separated integers L, S, and D, where:
- L is the length of a long jump.
- S is the length of a short jump.
- D is the target position.
outputFormat
For each test case, output a single line containing "YES" if Mary can exactly reach position D using a combination of long and short jumps, otherwise output "NO".
## sample3
3 5 13
4 6 11
7 2 14
YES
NO
YES
</p>