fork download
  1. #include <stdio.h>
  2.  
  3. int gcd(int a, int b) {
  4. if (b == 0) {
  5. return a;
  6. }
  7. return gcd(b, a % b);
  8. }
  9.  
  10. int main() {
  11. int n, a, b, c;
  12. scanf("%d", &n);
  13.  
  14. for (int i = 0; i < n; i++) {
  15. scanf("%d %d %d", &a, &b, &c);
  16.  
  17. int s = gcd(a, b);
  18.  
  19. printf("%s\n", (c > a && c > b) || (c % s != 0) ? "NO" : "YES");
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5296KB
stdin
3
8 1 5
4 4 3
5 3 4
stdout
YES
NO
YES