fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <string>
  5. #include <bits/stdc++.h>
  6.  
  7. using namespace std;
  8.  
  9. typedef vector<int> vi;
  10. #define ll long long
  11. #define all(v) ((v).begin()), ((v).end())
  12. #define sz(v) ((int)((v).size()))
  13.  
  14. #define vinp(v, n) \
  15.   for (int i = 0; i < (n); i++) \
  16.   cin >> (v)[i]
  17. #define printv(v) \
  18.   for (auto i : (v)) \
  19.   cout << i << " "
  20.  
  21. int main()
  22. {
  23. ios::sync_with_stdio(0);
  24. cin.tie(0);
  25. cout.tie(0);
  26. int x, y, c = 0;
  27. cin >> x >> y; // 1 0 100000000
  28. while (x--)
  29. {
  30. string s;
  31. cin >> s;
  32. if (s.size() >= y + 1)
  33. {
  34. int freq[9] = {};
  35. bool flag = true;
  36. for (int i = 0; i < s.size(); i++)
  37. {
  38. int u = s[i] - '0';
  39. if (u <= y)
  40. {
  41. freq[u]++;
  42. }
  43. }
  44. for (int i = 0; i <= y; i++)
  45. {
  46. if (freq[i] == 0)
  47. {
  48. flag = false;
  49. break;
  50. }
  51. }
  52. if (flag)
  53. {
  54. c++;
  55. }
  56. }
  57. }
  58. cout << c;
  59. }
Success #stdin #stdout 0.01s 5304KB
stdin
1 0
100000
stdout
1