SHARE
TWEET

Untitled

a guest Jan 14th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using  std::cin;
  3. using std::cout;
  4. using std::endl;
  5.  
  6. bool hasUniqueDigits( unsigned n, unsigned m=0)
  7. {
  8.     if(n >= 0 && n <= 9 && m == 0)
  9.     {
  10.         return true;
  11.     }
  12.     if(m&1<<(n%10))
  13.     {
  14.         return false;
  15.     }
  16.     else
  17.     {
  18.         m|=1<<(n%10);
  19.     }
  20.     return hasUniqueDigits(n/=10, m);
  21. }
  22.  
  23. int main()
  24. {
  25.     char c;
  26.     cin>>c;
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top