Advertisement
a53

CifreGen1

a53
Feb 4th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. long long int n,m,p=1;
  5. int cifra_m(long long int n,long long int m)
  6. {
  7. while(n)
  8. {
  9. if(n%10>=m)
  10. return 0;
  11. n/=10;
  12. }
  13. return 1;
  14. }
  15. int main()
  16. {
  17. cin>>n>>m;
  18. int nr=0;
  19. for(int i=1;i<=n;i++)
  20. {
  21. nr=nr*10+(m-1);
  22. p*=10;
  23. }
  24. p/=10;
  25. for(long long int i=p;i<=nr;i++)
  26. if(cifra_m(i,m))
  27. cout<<i<<'\n';
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement