Promi_38

cf 365A

Oct 22nd, 2021
652
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits\stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int t, k, cnt = 0;
  8.     cin >> t >> k;
  9.    
  10.     while(t--)
  11.     {
  12.         int n;
  13.         cin >> n;
  14.         set<int>ss;
  15.         while(n > 0)
  16.         {
  17.             if(n % 10 <= k) ss.insert(n % 10);
  18.             n /= 10;
  19.         }
  20.        
  21.         //printf("size %d first %d last %d\n", ss.size(), first, last);
  22.         if(ss.size() == k + 1) cnt++;
  23.     }
  24.     cout << cnt << endl;
  25.    
  26. }
RAW Paste Data