fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. void solve() {
  6. int x, y, a;
  7. cin >> x >> y >> a;
  8.  
  9. if (a % __gcd(x, y) == 0) {
  10. cout << "YES" << endl;
  11. } else {
  12. cout << "NO" << endl;
  13. }
  14. }
  15.  
  16. int main() {
  17. int t;
  18. cin >> t;
  19. while (t--) {
  20. solve();
  21. }
  22. }
  23.  
Success #stdin #stdout 0.01s 5292KB
stdin
3
1 2 4
2 1 4
2 2 1
stdout
YES
YES
NO