-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathominousnumber.cpp
More file actions
41 lines (39 loc) · 879 Bytes
/
Copy pathominousnumber.cpp
File metadata and controls
41 lines (39 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <math.h>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
int T; cin>>T;
while(T--){
int start, end, n, k;
cin>>n>>start>>end>>k;
set<int> s;
for(int i=0; i<n; i++){
int x; cin>>x;
s.insert(x);
}
int ans = 0;
for(int i=start; i<=end; i++){
int currno = i;
int bad_digits = 0;
while(currno>0){
int currdig = currno%10;
if(s.find(currdig)!=s.end()){
bad_digits++;
}
currno=currno/10;
}
if(bad_digits>=k){
ans++;
}
}
cout<<ans<<endl;
}
}