fork download
  1. #include <iostream>
  2. using namespace std;
  3. #define ll long long
  4. #define ul unsigned long long
  5. #define pb push_back
  6. #define fi first
  7. #define se second
  8. #define nn '\n'
  9. #define pi pair<ll,ll>
  10. #define unmp unordered_map
  11. #define uns unordered_set
  12. ll mod = 1e9+7;
  13. const int N = 1e5 + 5;
  14. int MOD = 998244353;
  15. int bit[200000];
  16. int n, x,y,m;
  17. int dem = 0;
  18.  
  19.  
  20. bool snt(int z){
  21. for(int i =2; i*i <= z; i++){
  22. if(z % i == 0){
  23. return false;
  24. }
  25. }
  26. return true;
  27. }
  28. int main() {
  29. //freopen("BFS.INP", "r", stdin);
  30. //freopen("BFS.OUT", "w", stdout);
  31. ios_base::sync_with_stdio(0); cin.tie(0) ; cout.tie(0) ;
  32. cin >> n >> x >> y;
  33. for( int i = 1; i<= n ; i++){
  34. int z;
  35. cin >> z;
  36. if(snt(z)){
  37. int z1 = z - y;
  38. if(z1 % y == x% y){
  39. dem++;
  40. }
  41. }
  42. }
  43. cout << dem;
  44. }
  45.  
  46.  
Success #stdin #stdout 0.01s 5316KB
stdin
5 1 1
3 5 4 11 15
stdout
3