Knobody

Untitled

Jun 27th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define dbg(i,j) cout<<"I am "<<i<<" = "<<endl<<j<<endl;
  3. #define dbr(name,a) cout<<name<<endl;for(auto x:a)cout<<x<<" ";cout<<endl;
  4. #define DBR(name,a) cout<<name<<endl;for(auto x:a){ for(auto y:x)cout<<y<<" ";cout<<endl;}
  5. #define dbmp(name,a) cout<<name<<endl;for(auto x:a){ cout<<x.first<<"\t"<<x.second<<endl;}
  6. #define dbp(name,a) cout<<name<<endl;cout<<a.first<<"\t"<<a.second<<endl;
  7. #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  8. using namespace std;
  9.  
  10. typedef long long int big;
  11.  
  12. typedef  long double fig;
  13.  
  14. void fastscan(big &x)
  15. {
  16. bool neg = false;
  17. register big c;
  18. x = 0;
  19. c = getchar();
  20. if(c == '-')
  21. {
  22. neg = true;
  23. c = getchar();
  24. }
  25. for(;(c>47 && c<58);c=getchar()) x=(x<<1)+(x<<3)+c-48;
  26. if(neg) x *=-1;
  27. }
  28.  
  29. void fastprint(big n)
  30. {
  31.     if (n == 0)
  32.     {
  33.         putchar('0');
  34.         putchar('\n');
  35.     }
  36.     else if (n == -1)
  37.     {
  38.         putchar('-');
  39.         putchar('1');
  40.         putchar('\n');
  41.     }
  42.     else
  43.     {
  44.         big neg=0;
  45.         char buf[20];
  46.         if(n<0){
  47.             neg=1;
  48.             n=-n;
  49.         }
  50.         buf[10] = '\n';
  51.         big i = 9;
  52.         while (n)
  53.         {
  54.             buf[i--] = n % 10 + '0';
  55.             n /= 10;
  56.         }
  57.         if(neg)buf[i--]='-';
  58.         while (buf[i] != '\n')
  59.             putchar(buf[++i]);
  60.     }
  61. }
  62.  
  63.  
  64. int main(){
  65.     big n,k;
  66.     fastscan(n);
  67.     fastscan(k);
  68.     big count=0;
  69.     big t;
  70.     while(n--){
  71.         fastscan(t);
  72.         if(t%k==0){
  73.             count++;
  74.         }
  75.     }
  76.     fastprint(count);
  77. }
Add Comment
Please, Sign In to add comment