Advertisement
TwiNNeR

Totalno razlichni broevi

Nov 7th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,x;
  7.     scanf("%d%d",&n,&x);
  8.     int i,j,p;
  9.     while(n>0)
  10.     {
  11.         p=1;
  12.         n--;
  13.         for(i=n;i>0;i/=10)
  14.         {
  15.             for(j=x;j>0;j/=10)
  16.             {
  17.                 if(i%10==j%10)
  18.                 {
  19.                     p=0;
  20.                     break;
  21.                 }
  22.             }
  23.             if(p==0) break;
  24.         }
  25.         if(p)
  26.         {
  27.             printf("%d",n);
  28.             break;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement