Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <math.h>
- #include <set>
- using namespace std;
- bool iskgood(int n, int k)
- {
- set<int> v;
- while(n>0){
- v.insert(n%10);
- n/=10;}
- vector<int> vv(v.begin(),v.end());
- sort(vv.begin(),vv.end());
- if((int) vv.size()==k+1 and vv[0]==0 and vv[vv.size()-1]==k)
- return true;
- else
- return false;
- }
- int main()
- {
- int n, k;
- long int ans = 0L;
- cin >> n >> k;
- for(int x = 0; x < n; x++)
- {
- int num;
- cin >> num;
- if(iskgood(num,k)==true)
- ans++;
- }
- if(k==0 or k==9)
- cout << 0 << endl;
- else
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement