#K62037. Common Multiple in JUMP and STEP Sequences
Common Multiple in JUMP and STEP Sequences
Common Multiple in JUMP and STEP Sequences
You are given three integers A, B, and N. In this problem, we define two sequences: the JUMP sequence and the STEP sequence. A number appears in the JUMP sequence if it is a multiple of A, and it appears in the STEP sequence if it is a multiple of B. Therefore, N can appear in both sequences if and only if it is a multiple of both A and B. Mathematically, N should satisfy the conditions:
\( N \equiv 0 \pmod{A} \) and \( N \equiv 0 \pmod{B} \).
Your task is to determine, for each test case, whether N meets the criteria. If it does, print "YES"; otherwise, print "NO".
inputFormat
The first line contains a single integer \( T \), representing the number of test cases. Each of the following \( T \) lines contains three space-separated integers \( A \), \( B \), and \( N \).
outputFormat
For each test case, output a single line. Print "YES" if \( N \) is divisible by both \( A \) and \( B \), otherwise print "NO".
## sample6
3 5 15
4 6 24
5 10 50
7 11 77
4 6 23
5 3 17
YES
YES
YES
YES
NO
NO
</p>