Codeforces Round #213 (Div. 2) A. Good Number

OpenSoucre發表於2013-11-24
#include <iostream>
#include <vector>

using namespace std;
int main(){
    int n,k,cnt = 0;
    cin >> n >>k;
    for( int i = 0 ; i < n ;  ++ i ){
        int a;
        vector<int> goodNum(k+1,0);
        cin >> a;
        while(a){
            if(a%10<=k) goodNum[a%10]++;
            a/=10;
        }
        int j  = 0;
        for(j = 0 ; j < k+1; ++ j)
            if(!goodNum[j]) break;
        if(j >= k +1) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

 

相關文章