Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- int main()
- {
- int n, x;
- scanf("%d %d", &n, &x);
- int kopija = x;
- int totalno;
- for (int i = n - 1; i > 0; i--)
- {
- totalno = 0;
- x = kopija;
- while (x > 0)
- {
- int b = i;
- int cifra = x % 10;
- x /= 10;
- while (b > 0)
- {
- int a = b % 10;
- b /= 10;
- if (a == cifra)
- {
- totalno = 1;
- }
- }
- }
- if (totalno == 0)
- {
- printf("%d", i);
- break;
- }
- }
- if (totalno != 0)
- printf("0");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement