enable_btn_set = {str(x) for x in range(11)}
N = int(input())
break_button_num = int(input())
if(break_button_num == 0):
pass
else:
break_button = set(input().split())
enable_btn_set -= break_button
result = abs(N - 100)
for i in range(1000001):
is_enable = True
for div_num in str(i):
if(div_num not in enable_btn_set):
is_enable = False
if(is_enable):
result = min(result, abs(N - i) + len(str(i)))
print(result)
'# 코딩 문제 관련 > 파이썬' 카테고리의 다른 글
백준 10814번(python) (3) | 2019.07.19 |
---|---|
백준 11650번(python) (0) | 2019.07.19 |
백준 1436번(python) (1) | 2019.07.08 |
백준 1018번(python) (0) | 2019.07.08 |
백준 7568번(python) (0) | 2019.07.07 |