fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base :: sync_with_stdio(false);
  6. cin.tie(NULL);
  7. int t;
  8. cin >> t;
  9. while(t--){
  10. int n, x, y;
  11. cin >> n >> x >> y;
  12. if(y == 0){
  13. cout << "YES" << endl;
  14. }
  15. else if(y % x == 0){
  16. cout << "YES" << endl;
  17. }
  18. else {
  19. cout << "NO" << endl;
  20. }
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5316KB
stdin
5
1 8 4
3 6 12
4 5 0
10 10 100
8 5 36
stdout
NO
YES
YES
YES
NO