Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long long int n,m,p=1;
- int cifra_m(long long int n,long long int m)
- {
- while(n)
- {
- if(n%10>=m)
- return 0;
- n/=10;
- }
- return 1;
- }
- int main()
- {
- cin>>n>>m;
- int nr=0;
- for(int i=1;i<=n;i++)
- {
- nr=nr*10+(m-1);
- p*=10;
- }
- p/=10;
- for(long long int i=p;i<=nr;i++)
- if(cifra_m(i,m))
- cout<<i<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement