SHARE
TWEET

Untitled

a guest Apr 21st, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 7 => 7
  2. 1000 => 819
  3. 3456 => 2562
  4. 10000 => 7380
  5.    
  6. f(int n)
  7. {
  8.     int i=1;
  9.     int c=n;
  10.  
  11.     for(; i<=n; i++)
  12.     {
  13.         int m=-1;
  14.         int x=i;
  15.  
  16.         while(x)
  17.         {
  18.             if (x % 10 == m)
  19.             {
  20.                 c--;
  21.                 break;
  22.             }
  23.             m = x % 10;
  24.             x /= 10;
  25.        }
  26.    }
  27.    return c;
  28. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top