fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long x, y, n, a;
  6. cin >> x >> y >> n;
  7. while (n--) {
  8. cin >> a;
  9. if ((a == 2) || (x % a == 0 && (y - 2) % a == 0) || ((x - 1) % a == 0 && (y - 1) % a == 0) || ((x - 2) % a == 0 && y % a == 0))
  10. cout << "YES"
  11. << "\n";
  12. else
  13. cout << "NO"
  14. << "\n";
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 15232KB
stdin
5 6 
2
3 4
stdout
YES
NO