Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- long long q,a,b,k;
- string l,r;
- int valid(long long x){
- int ret=0;
- long long tem=x;
- while(tem){
- if(tem%10)
- ret+=!(x%(tem%10));
- tem/=10;
- }
- return ret>=k;
- }
- int main(){
- cin>>q;
- while(q--){
- cin>>a>>b>>k;
- int ans=0;
- for(long long i=a;i<=b;i++)
- ans+=valid(i);
- cout<<ans<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement