fork download
  1. #include <iostream>
  2. using namespace std;
  3. bool kt(int a) {
  4. if (a == 1) return false;
  5. for (int i = 2; i < a; i++) if (a%i == 0) return false;
  6. return true;
  7. }
  8. int main() {
  9. int n, m, a[100];
  10. cin >> n >> m;
  11. for (int i = 0; i < m; i++) cin >> a[i];
  12. for (int i = 0; i < m; i++) if ((n%a[i] == 0) && (kt(a[i]))) cout << "YES" << endl;
  13. else cout << "NO" << endl;
  14. return 0;
  15. }
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
NO
NO
NO
NO
NO
NO
NO