fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct FastRead {
  5. char *buff, *ptr;
  6. FastRead(int size) {
  7. buff = new char[size];
  8. ptr = buff;
  9. fread(buff, size, 1, stdin);
  10. }
  11. ~FastRead() {
  12. delete[] buff;
  13. }
  14. inline unsigned long long int nextInt() {
  15. unsigned long long int ret = 0;
  16. while(*ptr < '0' || *ptr > '9') ptr++;
  17. do { ret = (ret<<1)+ (ret<<3) + *ptr++ - '0';
  18. } while(*ptr >= '0' && *ptr <= '9');
  19. return ret;
  20. }
  21. };
  22. template <class T> inline void write(T x)
  23. {
  24. int i = 20;
  25. char buf[21];
  26. // buf[10] = 0;
  27. buf[20] = '\n';
  28.  
  29. do
  30. {
  31. buf[--i] = x % 10 + '0';
  32. x/= 10;
  33. }while(x);
  34. do
  35. {
  36. putchar(buf[i]);
  37. } while (buf[i++] != '\n');
  38. }
  39. int main()
  40. {
  41. FastRead r(4194304);
  42.  
  43. int n=r.nextInt();
  44. int d=r.nextInt();
  45. long int temp;
  46. int count=0;
  47. for(int i=0;i<n;i++)
  48. { temp=r.nextInt();
  49. if(temp%d==0)
  50. ++count;
  51. }
  52. write<int>(count);
  53. return 0;
  54. }
  55.  
Success #stdin #stdout 0s 3344KB
stdin
7 3
1
51
966369
7
9
999996
11
stdout
4