Created
July 21, 2017 08:43
-
-
Save IKKO-Ohta/675528bed26b30ffc12c2ca5e7430c3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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