Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Created July 21, 2017 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/675528bed26b30ffc12c2ca5e7430c3b to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/675528bed26b30ffc12c2ca5e7430c3b to your computer and use it in GitHub Desktop.
nums = [int(x) for x in input().split()]
N,K = nums[0],nums[1]
D = set([int(x) for x in input().split()])
ans = N
def solve(M):
M = [int(x) for x in str(M)]
for m in M:
if m in D: return False
return True
while(1):
if solve(ans):
print(ans)
break
else:
ans +=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment