Skip to content

Commit

Permalink
22-gjsk132
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsk132 committed Feb 14, 2024
1 parent 7592a3c commit 07ff007
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions gjsk132/Brute Force/1107 ๋ฆฌ๋ชจ์ปจ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
input = open(0).readline

cannel = []

target = int(input())

limit = target*2 + 100

upDown = target - 100 if target > 100 else 100 - target

cnt = 0

if (brokenCnt := int(input())):
broken = list(map(str,input().split()))

for i in range(limit):
cannel.append(False if any(b in str(i) for b in broken) else True)

while cnt < upDown:

if (cannel[target-cnt] if target>=cnt else False):
cnt += len(str(target-cnt))
break

if (cannel[target+cnt] if target+cnt < limit else False):
cnt += len(str(target+cnt))
break

cnt += 1
else:
cnt += len(str(target))

print(min(cnt, upDown))
1 change: 1 addition & 0 deletions gjsk132/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
| 18์ฐจ์‹œ | 2024.02.01 | Implemetation | [12904 A์™€ B](https://www.acmicpc.net/problem/12094) | [๐Ÿ…ฐ๐Ÿ…ฑ](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/90) |
| 19์ฐจ์‹œ | 2024.02.05 | BFS | [1697 ์ˆจ๋ฐ”๊ผญ์งˆ](https://www.acmicpc.net/problem/1697) | [๐Ÿซฃ](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/95) |
| 20์ฐจ์‹œ | 2024.02.09 | Knapsack Problem | [12865 ํ‰๋ฒ”ํ•œ ๋ฐฐ๋‚ญ](https://www.acmicpc.net/problem/12865) | [๐ŸŽ’](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/100) |
| 22์ฐจ์‹œ | 2024.02.15 | Brute Froce | [1107 ๋ฆฌ๋ชจ์ปจ](https://www.acmicpc.net/problem/1107) | [๐Ÿ“ฒ](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/106) |
---

0 comments on commit 07ff007

Please sign in to comment.